Created
April 1, 2017 14:13
-
-
Save thanoojgithub/2b586af7bb45ad95ba70c65f51a00e16 to your computer and use it in GitHub Desktop.
How to delete files listed in a text file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pwd | |
| current_pwd=`pwd` | |
| cd /home/thanooj/work | |
| pwd | |
| ls -ltr | |
| for f in $(cat /home/thanooj/files/symlink_localized_file_list.txt); do | |
| rm "$f" | |
| done | |
| ls -ltr | |
| cd $current_pwd | |
| ls -ltr | |
| pwd | |
| NOTE: | |
| For removing directories recursively and forcefully: | |
| rm -rf "$f" | |
| If those file are symbolic link - remove symbolic link: | |
| unlink "$f" | |
| Creating symbolic link: | |
| ln -s /home/thanooj/files/dailycached.txt /home/thanooj/files/dailycached_symbolic_link.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment