Shell Scripts





Español Français 中文 Deutsch Portuguese Japanese nederlands
   
 
Free Shell Scripts
List All
Rename File
Rename Multiple Files
Remove Files From Folder
Fun Dancing Script
Dancing Move
FTP Login Report
Netstats

 





outsourced web hosting support

Recursively Remove Files From Folder


About
A shell script that is used to recursively remove any pattern of files like swap files, thumb.db files, etc, under a given folder and the subfolders under the given folder.


Features
a) Recursively Remove your unwanted files in a fraction of second.
b) It makes easier to find and delete the swap files under the folder and subfolder of the given path.
c) Just copy the code and use it in your command prompt.
d) Fast and simple remove files shell script.

Code
#------------------  Script by hscripts.com    ------------------#
#-----------------   Copyright of HIOXINDIA    ------------------#
#--------------  More scripts @www.hscripts.com   ---------------#

 #!/bin/bash

  echo "Enter Folder Name under which you want to remove files:";
  read fname
  echo "Enter the pattern to remove (for eg, if swap files give as *~ else if thumbs.db give as Thumbs.db)";
  read name1
    
  echo "Total Count of files found on the pattern" $name1;
  find $fname -type f -name "$name1" | xargs wc -l

  find $fname -type f -name "$name1" -exec rm {} \;

#------------ Script by hscripts.com -------------------------#

Release Date - 30-09-2010
Get free version without ©copyright link for just 5 price

For customization of this script or any script development, contact us at support@hscripts.com



Usage
a) Copy the above code and save it with .sh extension
b) Execute the shell script as sh filename.sh to remove the files recursively.
c) Give the foldername under which you want to delete the files.
d) It will prompt the user to enter the pattern.
e) Specify the pattern for removing. for eg,
* if you want to remove all swap files under the folder then do specify as "*~".
* if you want to remove all thumbs.db files under the folder then do specify as "Thumbs.db".
* Likewise you can also remove all error_log files, etc., recursively.
e) Finally it gives you the total number of files found for the pattern.


License
- The Unix Shell Scripts and examples is given under GPL License
- i.e. Free use for those who use it as it is.
- Free, if your modification does not remove our copyright information and links.
- For Detailed License information Click here
- If your requirements does not meet GPL License terms, you can purchase the script with us.
Other Links

web hosting