Skip to main content
deleted 4 characters in body; edited tags; edited title
Source Link
don_crissti
  • 85.7k
  • 31
  • 234
  • 262

BASH: rename multiple Rename files using mv and a WHILE loop instead of a FOR loop

Consider we have many photos with names like DSC_20170506_170809.JPEG. To rename the photos so that they follow the pattern Paris_20170506_170809.JPEG, I've wrote the following script that works perfect.

for file in *.JPEG; do mv ${file} ${file/DSC/Paris}; done

My question is , how we can write this script using a whilewhile loop instead of a forfor loop?

BASH: rename multiple files using mv and a WHILE loop

Consider we have many photos with names like DSC_20170506_170809.JPEG. To rename the photos so that they follow the pattern Paris_20170506_170809.JPEG, I've wrote the following script that works perfect.

for file in *.JPEG; do mv ${file} ${file/DSC/Paris}; done

My question is , how we can write this script using a while loop instead of a for loop?

Rename files using a WHILE loop instead of a FOR loop

Consider we have many photos with names like DSC_20170506_170809.JPEG. To rename the photos so that they follow the pattern Paris_20170506_170809.JPEG, I've wrote the following script that works perfect.

for file in *.JPEG; do mv ${file} ${file/DSC/Paris}; done

My question is , how we can write this script using a while loop instead of a for loop?

Spelling and markup.
Source Link
Kusalananda
  • 356.2k
  • 42
  • 737
  • 1.1k

BASH: remamerename multiple files using mv and a WHILE loop

Consider we have many photesphotos with names like DSC_20170506_170809.JPEGDSC_20170506_170809.JPEG. To rename the photos so that they follow the pattern Paris_20170506_170809.JPEGParis_20170506_170809.JPEG, I've wrote the following script that works perfect.

for file in *.JPEG; do mv ${file} ${file/DSC/Paris}; done

My question is , how we can write this script using a while loop instead of a for loop?

BASH: remame multiple files using mv and a WHILE loop

Consider we have many photes with names like DSC_20170506_170809.JPEG. To rename the photos so that they follow the pattern Paris_20170506_170809.JPEG, I've wrote the following script that works perfect.

for file in *.JPEG; do mv ${file} ${file/DSC/Paris}; done

My question is , how we can write this script using a while loop instead of a for loop?

BASH: rename multiple files using mv and a WHILE loop

Consider we have many photos with names like DSC_20170506_170809.JPEG. To rename the photos so that they follow the pattern Paris_20170506_170809.JPEG, I've wrote the following script that works perfect.

for file in *.JPEG; do mv ${file} ${file/DSC/Paris}; done

My question is , how we can write this script using a while loop instead of a for loop?

Source Link
sci9
  • 527
  • 2
  • 8
  • 19

BASH: remame multiple files using mv and a WHILE loop

Consider we have many photes with names like DSC_20170506_170809.JPEG. To rename the photos so that they follow the pattern Paris_20170506_170809.JPEG, I've wrote the following script that works perfect.

for file in *.JPEG; do mv ${file} ${file/DSC/Paris}; done

My question is , how we can write this script using a while loop instead of a for loop?