Skip to main content

All Questions

0 votes
1 answer
283 views

Bash Script to Recursively Rename Files without changing file extension

I am attempting to rename all files (.jpg,.jpeg,.mov,etc) in parent directory and all subdirectories to date_time_7digitnumber without changing the file extension. The below script accomplishes this ...
Noob0321's user avatar
0 votes
1 answer
1k views

Renaming all files in a certain directory and sub directory on MacOS?

I'm trying out the code that answers this questions: How do I change the extension of multiple files? I tried this: # Rename all *.js to *.ts for f in *.js; do mv -- "$f" "${f%.js}....
Ole's user avatar
  • 747
2 votes
2 answers
2k views

Sort and mv files based on filename (with spaces), recursively

I have made a mistake and dumped files together into the same directory. Luckily I can sort them based on the filename: ''' 2019-02-19 20.18.58.ndpi_2_2688_2240.jpg ''' Where the # bit or 2 in this ...
SciGuy's user avatar
  • 207
1 vote
4 answers
2k views

How to rename files with different extensions

Say I have these files: essay.aux essay.out essay.dvi essay.pdf essay.fdb_latexmk essay.tex essay.fls essay.toc essay.log ...
nalzok's user avatar
  • 431
3 votes
2 answers
608 views

How to reformat sequence numbers in a batch of filenames, e.g. A1.txt to A0001.txt? [duplicate]

I have some files named as A1.txt A2.txt ... A11.txt A12.txt, etc. I want to rename them to A0001.txt A0002.txt ... A0011.txt etc. Am I doing it right? for file in A*.txt do mv ${file} ${file/-#.txt-/...
Christin's user avatar