The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Removing multiple files

Discussion in 'Data Protection' started by shamrocks, May 16, 2007.

  1. shamrocks

    shamrocks Member

    Joined:
    Jul 23, 2006
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    Hi,
    I have over 1000 files in my "/ public_html / STHS / (Current Folder)" folder and I was wondering what is the quickest way to remove these files.. There are other folders in this directory that I must not delete, along with other files as well. Can this be done, or do I have to go through each file and delete them individually?
    Thanks
     
  2. newphp

    newphp Member

    Joined:
    Dec 27, 2006
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Chongqing,China
    if you have shell access,then login shell
    cd ~/public_html/STHS
    rm * -f (it won't del your folders)

    if you don't have shell access,but you can use shell_exec() with php,then create a php file in this folders,example shell_del.php,with the following code
    PHP:
    <?php
    $command 
    "rm -f *";
    $result shell_exec($command." 2>&1");
    if(
    $result) print "You have delete all the file";
    ?>
    visit the shell_del.php one time.
    Done
     
  3. shamrocks

    shamrocks Member

    Joined:
    Jul 23, 2006
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    But there are also other files in that directory that I do not want to delete. Lets say there are 1200 files in the directory but I only want to delete 1000 of them, would I still use the above method?
    If so, where exactly would I go to do this? I never used Shell Access before or shell_Exec().
    Is this SQL within Cpanel, phpMyAdmin?
     
    #3 shamrocks, May 16, 2007
    Last edited: May 17, 2007
  4. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,474
    Likes Received:
    202
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    My guess is, you should simply go thru it manually and delete what you need to. You might find it a bit easier to do a full system backup, then download it, then go thru it locally.
     
  5. shamrocks

    shamrocks Member

    Joined:
    Jul 23, 2006
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    Ok, I am currently downloading a full system backup. When it is done, where do I go to download it? Once I go through it locally, how would I upload it again? Just curious as I never done this before.
     
  6. shamrocks

    shamrocks Member

    Joined:
    Jul 23, 2006
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    Ok,I have files extracted using Winzip. Now what do I do? I deleted the files I wanted, so how do I upload it again?
     
    #6 shamrocks, May 18, 2007
    Last edited: May 18, 2007
  7. WebScHoLaR

    WebScHoLaR Well-Known Member

    Joined:
    Dec 14, 2005
    Messages:
    511
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    Planet Earth
    Use your cPanel username/password to connect to the server via FTP and upload the files.
     
  8. shamrocks

    shamrocks Member

    Joined:
    Jul 23, 2006
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    sorry for my ignorance, but what exactly do I need to do in order to connect to the server via FTP? Download a FTP Client?
     
    #8 shamrocks, May 18, 2007
    Last edited: May 18, 2007
  9. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,474
    Likes Received:
    202
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Yes. My preference.

    When you run a full system backup, it's created in the root of your account. You download it from there by logging in via FTP client.
    But you don't want to upload just anything out of that backup. If you do you'll have more problems than you want.

    Make sure to keep that full backup for safe keeping just in case you kill the wrong files.

    Your host is better qualified to be answering these questions. This forum is for server administrators.
     
  10. shamrocks

    shamrocks Member

    Joined:
    Jul 23, 2006
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    Thanks Guys/Gals, got it sorted.
     
Loading...

Share This Page