* [gentoo-user] copy resize files with directories
@ 2012-12-21 5:07 Joseph
2012-12-21 5:19 ` Joseph
0 siblings, 1 reply; 2+ messages in thread
From: Joseph @ 2012-12-21 5:07 UTC (permalink / raw
To: gentoo-user
I've found this script that copy and resize file on the fly from one location to another.
for INPUT in ./*.JPG; do OUTPUT=/media/stick/`echo $INPUT | sed 's/\.JPG/\_new\.JPG/'`; echo $INPUT /media/stick/$OUTPUT; convert $INPUT -scale 800x $OUTPUT; done
I go into each directory manually and run this command, however my camera was originally
set to start the same file name every time I empty it so I have the same file name in may directories (the are not unique) so every time I run this script it re-writes
the original one.
The ideal situation would be go into each directory and create the same director directory on the destination disk with modified files
Can anybody suggest how can I rewrite this script to copy files together with directory or change the file to a unique one.
I would like to span all directory I'm IN and bellow and run that script on any directory below.
--
Joseph
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [gentoo-user] copy resize files with directories
2012-12-21 5:07 [gentoo-user] copy resize files with directories Joseph
@ 2012-12-21 5:19 ` Joseph
0 siblings, 0 replies; 2+ messages in thread
From: Joseph @ 2012-12-21 5:19 UTC (permalink / raw
To: gentoo-user
On 12/20/12 22:07, Joseph wrote:
>I've found this script that copy and resize file on the fly from one location to another.
>
>for INPUT in ./*.JPG; do OUTPUT=/media/stick/`echo $INPUT | sed 's/\.JPG/\_new\.JPG/'`; echo $INPUT /media/stick/$OUTPUT; convert $INPUT -scale 800x $OUTPUT; done
>
>I go into each directory manually and run this command, however my camera was originally
>set to start the same file name every time I empty it so I have the same file name in may directories (the are not unique) so every time I run this script it re-writes
>the original one.
>
>The ideal situation would be go into each directory and create the same director directory on the destination disk with modified files
>Can anybody suggest how can I rewrite this script to copy files together with directory or change the file to a unique one.
>
>I would like to span all directory I'm IN and bellow and run that script on any directory below.
I do I combine the script above with this one below:
find . -maxdepth 1 -type f -name "*rospslpar*" |while read filename; do
path_name=${filename%/*}
base_name=${filename##*/}
new_name="$(expr substr $base_name 14 6).jpg"
mv "$filename" "$path_name/$new_name"
done
It would help be rename the file with unique name.
--
Joseph
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-12-21 5:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-21 5:07 [gentoo-user] copy resize files with directories Joseph
2012-12-21 5:19 ` Joseph
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox