Skip to content

Instantly share code, notes, and snippets.

@7yl4r
Created October 25, 2019 20:26
Show Gist options
  • Save 7yl4r/668cc1eacef6dc73bfea20cde20eed67 to your computer and use it in GitHub Desktop.
Save 7yl4r/668cc1eacef6dc73bfea20cde20eed67 to your computer and use it in GitHub Desktop.
#!/bin/bash
n_dir=WV02_103001001DBB5300_M1BS-500064643130_01
mkdir $n_dir
mv ./WV02_20121119163317_103001001DBB5300_12NOV19163317-M1BS-500064643130_01_P003-BROWSE.jpg $n_dir/.
mv ./WV02_20121119163317_103001001DBB5300_12NOV19163317-M1BS-500064643130_01_P003.ntf $n_dir/.
mv ./WV02_20121119163317_103001001DBB5300_12NOV19163317-M1BS-500064643130_01_P003.rename $n_dir/.
mv ./WV02_20121119163317_103001001DBB5300_12NOV19163317-M1BS-500064643130_01_P003.tar $n_dir/.
mv ./WV02_20121119163317_103001001DBB5300_12NOV19163317-M1BS-500064643130_01_P003.xml $n_dir/.
$n_dir=WV02_103001001DBB5300_M1BS-500064643130_01
mkdir $n_dir
mv ./WV02_20121119163316_103001001DBB5300_12NOV19163316-M1BS-500064643130_01_P002-BROWSE.jpg $n_dir/.
mv ./WV02_20121119163316_103001001DBB5300_12NOV19163316-M1BS-500064643130_01_P002.ntf $n_dir/.
mv ./WV02_20121119163316_103001001DBB5300_12NOV19163316-M1BS-500064643130_01_P002.rename $n_dir/.
mv ./WV02_20121119163316_103001001DBB5300_12NOV19163316-M1BS-500064643130_01_P002.tar $n_dir/.
mv ./WV02_20121119163316_103001001DBB5300_12NOV19163316-M1BS-500064643130_01_P002.xml $n_dir/.
$n_dir=WV02_103001001DBB5300_M1BS_500064643130_01
mkdir $n_dir
mv ./WV02_20121119163315_103001001DBB5300_12NOV19163315-M1BS-500064643130_01_P001-BROWSE.jpg $n_dir/.
mv ./WV02_20121119163315_103001001DBB5300_12NOV19163315-M1BS-500064643130_01_P001.ntf $n_dir/.
mv ./WV02_20121119163315_103001001DBB5300_12NOV19163315-M1BS-500064643130_01_P001.rename $n_dir/.
mv ./WV02_20121119163315_103001001DBB5300_12NOV19163315-M1BS-500064643130_01_P001.tar $n_dir/.
mv ./WV02_20121119163315_103001001DBB5300_12NOV19163315-M1BS-500064643130_01_P001.xml $n_dir/.
$n_dir=WV02_103001000795CB00_P1BS_010639886010_01
mkdir $n_dir
mv ./WV02_20101010160644_103001000795CB00_10OCT10160644-P1BS-010639886010_01_P002-BROWSE.jpg $n_dir/.
mv ./WV02_20101010160644_103001000795CB00_10OCT10160644-P1BS-010639886010_01_P002.rename $n_dir
mv ./WV02_20101010160644_103001000795CB00_10OCT10160644-P1BS-010639886010_01_P002.tar $n_dir/.
mv ./WV02_20101010160644_103001000795CB00_10OCT10160644-P1BS-010639886010_01_P002.tif $n_dir/.
mv ./WV02_20101010160644_103001000795CB00_10OCT10160644-P1BS-010639886010_01_P002.xml $n_dir/.
$n_dir=WV02_103001000795CB00_M1BS_010639886010_01
mkdir $n_dir
mv ./WV02_20101010160644_103001000795CB00_10OCT10160644-M1BS-010639886010_01_P002-BROWSE.jpg $n_dir/.
mv ./WV02_20101010160644_103001000795CB00_10OCT10160644-M1BS-010639886010_01_P002.rename $n_dir
mv ./WV02_20101010160644_103001000795CB00_10OCT10160644-M1BS-010639886010_01_P002.tar $n_dir/.
mv ./WV02_20101010160644_103001000795CB00_10OCT10160644-M1BS-010639886010_01_P002.tif $n_dir/.
mv ./WV02_20101010160644_103001000795CB00_10OCT10160644-M1BS-010639886010_01_P002.xml $n_dir/.
$n_dir=WV02_103001000795CB00_P1BS_010639886010_01
mkdir $n_dir
mv ./WV02_20101010160643_103001000795CB00_10OCT10160643-P1BS-010639886010_01_P001-BROWSE.jpg $n_dir/.
mv ./WV02_20101010160643_103001000795CB00_10OCT10160643-P1BS-010639886010_01_P001.rename $n_dir
mv ./WV02_20101010160643_103001000795CB00_10OCT10160643-P1BS-010639886010_01_P001.tar $n_dir/.
mv ./WV02_20101010160643_103001000795CB00_10OCT10160643-P1BS-010639886010_01_P001.tif $n_dir/.
mv ./WV02_20101010160643_103001000795CB00_10OCT10160643-P1BS-010639886010_01_P001.xml $n_dir/.
$n_dir=WV02_103001000795CB00_M1BS_010639886010_01
mkdir $n_dir
mv ./WV02_20101010160643_103001000795CB00_10OCT10160643-M1BS-010639886010_01_P001-BROWSE.jpg $n_dir/.
mv ./WV02_20101010160643_103001000795CB00_10OCT10160643-M1BS-010639886010_01_P001.rename $n_dir
mv ./WV02_20101010160643_103001000795CB00_10OCT10160643-M1BS-010639886010_01_P001.tar $n_dir/.
mv ./WV02_20101010160643_103001000795CB00_10OCT10160643-M1BS-010639886010_01_P001.tif $n_dir/.
mv ./WV02_20101010160643_103001000795CB00_10OCT10160643-M1BS-010639886010_01_P001.xml $n_dir/.
@7yl4r
Copy link
Author

7yl4r commented Oct 25, 2019

this throws some expected errors because some of these files go into the same directory:

./fix_dirless_files.sh: line 10: WV02_103001001DBB5300_M1BS-500064643130_01=WV02_103001001DBB5300_M1BS-500064643130_01: command not found
mkdir: cannot create directory ‘WV02_103001001DBB5300_M1BS-500064643130_01’: File exists
./fix_dirless_files.sh: line 18: WV02_103001001DBB5300_M1BS-500064643130_01=WV02_103001001DBB5300_M1BS_500064643130_01: command not found
mkdir: cannot create directory ‘WV02_103001001DBB5300_M1BS-500064643130_01’: File exists
./fix_dirless_files.sh: line 26: WV02_103001001DBB5300_M1BS-500064643130_01=WV02_103001000795CB00_P1BS_010639886010_01: command not found
mkdir: cannot create directory ‘WV02_103001001DBB5300_M1BS-500064643130_01’: File exists
./fix_dirless_files.sh: line 34: WV02_103001001DBB5300_M1BS-500064643130_01=WV02_103001000795CB00_M1BS_010639886010_01: command not found
mkdir: cannot create directory ‘WV02_103001001DBB5300_M1BS-500064643130_01’: File exists
./fix_dirless_files.sh: line 43: WV02_103001001DBB5300_M1BS-500064643130_01=WV02_103001000795CB00_P1BS_010639886010_01: command not found
mkdir: cannot create directory ‘WV02_103001001DBB5300_M1BS-500064643130_01’: File exists
./fix_dirless_files.sh: line 52: WV02_103001001DBB5300_M1BS-500064643130_01=WV02_103001000795CB00_M1BS_010639886010_01: command not found
mkdir: cannot create directory ‘WV02_103001001DBB5300_M1BS-500064643130_01’: File exists

it's fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment