can anybody give me a solution to enlarge all files of same extension by 264 bytes on entire hard disk? truncate -s +264 /*encrypted
would enlarge all *.encrypted files by 264 bytes but only in one directory.
I want it to do the subfolders as well
can anybody give me a solution to enlarge all files of same extension by 264 bytes on entire hard disk? truncate -s +264 /*encrypted
would enlarge all *.encrypted files by 264 bytes but only in one directory.
I want it to do the subfolders as well
Try this:
find /path/to/directory -type f -name "*.encrypted" -exec truncate -s +264 {} +
find
will search in the /path/to/directory
and all of its subdirectories for files with .encrypted
extension and then run your desired truncate
command over all of those found files.
If you want to search for the files in entire disk:
sudo find / -type f -name "*.encrypted" -exec truncate -s +264 {} +
If you are not sure about the names, don't run this one rather you should explicitly mention the directories (and its subdirectories) to search for, for example the following will find and execute the command over the only the files found in /home/user
and /tmp
directories (and their subdirectories):
find /home/user/ /tmp/ -type f -name "*.encrypted" -exec truncate -s +264 {} +
Note that you need to use sudo
to search in the directories where you don't have required permission.