mass file movement
I am trying to move the huge no of file into different folder..
the files in the style of "HNI [0-9]{3}.*.jpg"
i.e
HnI 001.Sunday Party.jpg
HnI 002.Car.jpg
.
.
.
and so on
I want to place the certian no of files in the single folder
like.. . mv file1 file2.... fileN destination
i tested with something like ....
$for i in *.jpg; do n=`echo $i |cut -b 5-7`; if [ $(($n > 30)) ]; then echo $n; fi; done;
025
026
027
bash: 028: value too great for base (error token is "028")
can't understand what the problem...
and is there any easy method Pls Help!
Rhohitman
Junior Poster in Training
86 posts since Dec 2007
Reputation Points: 10
Solved Threads: 5
Because it is assuming that numbers that start with 0 are octal numbers. ctal numbers can only have digits from 0-7. If you only want to move files where the number is greater then 030 do
mv *[3-9][0-9].jpg *[1-9][0-9][0-9].jpg destination
masijade
Industrious Poster
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
ahh.. thanx a lot!
it took 30min i did manually!
and cheak back this post! :'(
Rhohitman
Junior Poster in Training
86 posts since Dec 2007
Reputation Points: 10
Solved Threads: 5
it seem to be blizzard! lots of thanxs to "masijade"
what i did was create the test scenario, (no file left to do coz i did it manually)
mkdir Test
touch `seq -f test%03.f.file 7 4 106`; ls
mkdir `seq -f vol%02.f 1 9`; ls
then i executed ur code voila.. it works..
then i thought.. of upper limit... hmmm..
what about
seq
.. lol.. how stupid i'am
4-5 test.. i got my results!!!!
mv `seq -f test%03.f.file 31 4 50` vol07/; ls vol07/;
this is what i did!
rhohit@TurionBox:~/bog/Test$ ls
test007.file test031.file test055.file test079.file test103.file vol06
test011.file test035.file test059.file test083.file vol01 vol07
test015.file test039.file test063.file test087.file vol02 vol08
test019.file test043.file test067.file test091.file vol03 vol09
test023.file test047.file test071.file test095.file vol04
test027.file test051.file test075.file test099.file vol05
rhohit@TurionBox:~/bog/Test$ ls vol07
rhohit@TurionBox:~/bog/Test$ mv `seq 'test%03.f.file'` vol07/; ls vol07/;
seq: invalid floating point argument: test%03.f.file
Try `seq --help' for more information.
mv: missing destination file operand after `vol07/'
Try `mv --help' for more information.
rhohit@TurionBox:~/bog/Test$ mv `seq 'test%03.f.file'`^Col07/; ls vol07/;
rhohit@TurionBox:~/bog/Test$ seq 1 10
1
2
3
4
5
6
7
8
9
10
rhohit@TurionBox:~/bog/Test$ mv `seq test%03.f.file` vol07/; ls vol07/;
seq: invalid floating point argument: test%03.f.file
Try `seq --help' for more information.
mv: missing destination file operand after `vol07/'
Try `mv --help' for more information.
rhohit@TurionBox:~/bog/Test$ mv `seq test%03.f.file 31 4 50` vol07/; ls vol07/;
seq: extra operand `50'
Try `seq --help' for more information.
mv: missing destination file operand after `vol07/'
Try `mv --help' for more information.
rhohit@TurionBox:~/bog/Test$ mv `seq test%03.f.file 31 50` vol07/; ls vol07/;
seq: invalid floating point argument: test%03.f.file
Try `seq --help' for more information.
mv: missing destination file operand after `vol07/'
Try `mv --help' for more information.
rhohit@TurionBox:~/bog/Test$ seq test%03.f.file 31 50
seq: invalid floating point argument: test%03.f.file
Try `seq --help' for more information.
rhohit@TurionBox:~/bog/Test$ mv `seq -f test%03.f.file 31 4 50` vol07/; ls vol07/;
test031.file test035.file test039.file test043.file test047.file
rhohit@TurionBox:~/bog/Test$ ls
test007.file test027.file test067.file test087.file vol01 vol06
test011.file test051.file test071.file test091.file vol02 vol07
test015.file test055.file test075.file test095.file vol03 vol08
test019.file test059.file test079.file test099.file vol04 vol09
test023.file test063.file test083.file test103.file vol05
rhohit@TurionBox:~/bog/Test$
Rhohitman
Junior Poster in Training
86 posts since Dec 2007
Reputation Points: 10
Solved Threads: 5