1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to delete a file with putty?

Discussion in 'Apache' started by 123GoToAndPlay, Apr 14, 2009.

  1. #1
    Hi,

    i have an unwanted file in my images folder and i am trying to delete this file without succes;

    My normal ftp program doesn't delete the file

    and with putty i tried

    rm watermark.php?folder=voor_dat&width=300&article=6163

    2/ is there a way to change the extension of this file to .jpg?
    SEMrush
    regards
     
    123GoToAndPlay, Apr 14, 2009 IP
    SEMrush
  2. jestep

    jestep Prominent Member Premium Member

    Messages:
    3,661
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    That's a script and not an image.

    To remove a file, do what you were trying. You can also hit tab to get a list of possible options. TO remove the above script use:

    rm watermark.php
     
    jestep, Apr 14, 2009 IP
  3. 123GoToAndPlay

    123GoToAndPlay Peon

    Messages:
    669
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    i tried your suggestion but i get

    rm: cannot remove watermark.php: No such file or directory

    it still there.


    btw it outputs an image in jpg. But in this case i see the extension is set to
    
    php?folder=voor_dat&width=300&article=6163
    
    Code (markup):
     
    123GoToAndPlay, Apr 14, 2009 IP
  4. 123GoToAndPlay

    123GoToAndPlay Peon

    Messages:
    669
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    this seemed to work

    
    rm -rf test
    
    Code (markup):
    to delete the whole directory test, but also no luck :(
     
    123GoToAndPlay, Apr 14, 2009 IP
  5. kailash

    kailash Well-Known Member

    Messages:
    1,251
    Likes Received:
    42
    Best Answers:
    0
    Trophy Points:
    100
    #5
    try

    rm watermark*

    Kailash
     
    kailash, Apr 16, 2009 IP
  6. BooyahFernis

    BooyahFernis Peon

    Messages:
    30
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    rm -rf is what I always use.
     
    BooyahFernis, Apr 26, 2009 IP
  7. genius24k

    genius24k Active Member

    Messages:
    114
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    58
    #7
    you will need to find the folder on the server, if your not sure where the main folder is check your apache config you can find the path there then.

    cd toimagefolder
    then
    rm theimage.jpg
     
    genius24k, Apr 28, 2009 IP
  8. ianwate

    ianwate Peon

    Messages:
    209
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #8
    try rm -rf 'watermark.php?folder=voor_dat&width=300&article=6163'
    or rm -rf "watermark.php?folder=voor_dat&width=300&article=6163"

    put '' or ""
     
    ianwate, Apr 29, 2009 IP
  9. hostechsupport

    hostechsupport Well-Known Member

    Messages:
    413
    Likes Received:
    23
    Best Answers:
    7
    Trophy Points:
    138
    #9
    >> You can login to your image folder and then delete that particular file from that folder.
    You can refer to the below steps to delete the file:
    cd imagefolder
    Then use
    rm-r filename
     
    hostechsupport, Apr 17, 2018 IP
  10. NixonB

    NixonB Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #10
    Here you can use the following commands to delete the files/folders
    - rm filename.txt
    To delete a whole folder and its content recursively:
    - rm -rf foldername/
    To delete all files/folders in the current directory:
    - rm -rf*
     
    NixonB, Apr 21, 2018 IP
  11. AlphaNine_Vini

    AlphaNine_Vini Active Member

    Messages:
    219
    Likes Received:
    10
    Best Answers:
    1
    Trophy Points:
    88
    #11
    Thats a script and its creating the image using the actual image location in some other folder. I recommend to view the source code of the script to find where exactly the images are located. You can delete those images or replace them if you wanted.
     
    AlphaNine_Vini, Apr 25, 2018 IP
  12. Cameron Fillers

    Cameron Fillers Member

    Messages:
    33
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    33
    #12
    The issue that you are having is probably a result of the special character ?

    with putty, you can perform an autocomplete by hitting TAB, so my recommendation would be to write the following...

    #rm -f watermark
    and then hit tab, and then surround the entire filename with double quotes "

    see if that works. If that does not work, verify that you are the owner of the file

    #ls -l "watermark*"

    also check the permission. For now, it may be best to just set the permissions to 777

    #chmod 777 "watermark*"

    and then try to delete it again.

    If all that does not work, then create a new folder called "temp"
    and then move the file into that folder

    #mv "watermark*" temp/
    and then delete temp
    #rm -fR temp

    and if that still does not work, then change directory into the temp directory...

    #cd temp/
    perform a list to view the contents and verify the file is inside
    #ls -lA

    and then we will run another command for the purposes of deleting content. Be careful, as this will delete everything in the folder

    #find . -type f -delete

    hopefully one of those suggestions will resolve your issue
     
    Cameron Fillers, Jul 27, 2018 IP