physicalgenius
New Member
I have a text file(.txt) containing a list of files (one per line) which have to be deleted from a folder on my server. The files to be deleted from the server have to match names of the files in the text file. I wrote a small bash script to do this. Did some research online. When I run the script, it says:
"rm: removing »/var/www/pathToFolder/2011.zip\r“ is not posible: file or folder not found"
But when I execute the rm command and give in the path, it does delete the file.
Bash script:
for file in `xargs < list_of_files_to_be_deleted_1.txt`;
do rm /var/www/projects/path_To_Folder_Having_Both_Text_And_Files_To_Be_Deleted/"$file";
done
then I run "bash delete_files.sh" --> the bash file in found in the same folder
Thanks for any help.
"rm: removing »/var/www/pathToFolder/2011.zip\r“ is not posible: file or folder not found"
But when I execute the rm command and give in the path, it does delete the file.
Bash script:
for file in `xargs < list_of_files_to_be_deleted_1.txt`;
do rm /var/www/projects/path_To_Folder_Having_Both_Text_And_Files_To_Be_Deleted/"$file";
done
then I run "bash delete_files.sh" --> the bash file in found in the same folder
Thanks for any help.