I want to find all files with specific name “stdout.1.0”, move it two/three levels up from its location. While moving it two/three levels up, I also want to rename it to “testjob.out”. All “stdout.1.0” files are located six levels down from parent directory. I used: and it outputs: The directories above is just representative of where the file is, but
Tag: file-management
Renaming Sequentially Named Files with Date Embedded
The Situation: I have hundreds of zip files with an arbitrary date/time mixed into its name (4-6-2021 12-34-09 AM.zip). I need to get all of these files in order such that (0.zip, 1.zip 2.zip etc) with in a Linux cli system. What I’ve tried: I’ve tried ls -tr | while read i; do n=$((n+1)); mv — “$i” “$(printf ‘%03d’ “$n”).zip”;
Understanding Unix Owner and chmod 777
I understand, Unix has 3 levels of ownership: Owner, Group, and Others. The owner is the one who creates the file and later on this Ownership can be moved using ‘chown’. However, I am confused with chmod 777 to ‘others’ or ‘groups’. Executing the previous command on a file will also allow the users in the group/other to have the
Delete all files except a few using bash command
I have a directory containing lot of files in different formats. I would like to know how I can delete all files with specific format (Lets say *.dat) except a few files in a same format (e.g. A.dat and B.dat). Please advise! Answer I’d write a little script (as a command-line one-liner it is slightly too big): As an alternative,