On Wed, 25 Jun 2008 22:42:47 +0200
Alan McKinnon <[EMAIL PROTECTED]> wrote:
> Isn't there a little known and unused but very useful command that
> already does this? This type of usage often comes up on mailing lists
> and invariably someone mentions it after 20 posts or so, but I can
> never
On Wednesday 25 June 2008, Grant wrote:
> > This:
> >j = basename $i .jpg
> > should be more like this:
> >j=$( basename $i .jpg )
> >
> > Or: j=${i%.jpg}
> >
> > That is, there must be no whitespace around the '='. And in order
> > to set j to the result of a command, use $( c
>> >> > cd dir1
>> >> > for i in *jpg
>> >> > do
>> >> > j = basename $i .jpg
>> >> > cp -u ${j}.jpg dir2/${j}_original.jpg
>> >> > done
>> >> >
>> >> > 'cp -u' works around the messy problem of checking if the
>> >> > destination file exists
> [...]
>> I put the above script in a file, added the
Grant asks:
> >> > cd dir1
> >> > for i in *jpg
> >> > do
> >> > j = basename $i .jpg
> >> > cp -u ${j}.jpg dir2/${j}_original.jpg
> >> > done
> >> >
> >> > 'cp -u' works around the messy problem of checking if the
> >> > destination file exists
[...]
> I put the above script in a file, added th
>> >> Feel free to ignore me here, but if anyone could whip out a quick
>> >> script for this I would really appreciate it.
>> >>
>> >> I need to move any files from dir1 to dir2 if they don't already
>> >> exist in dir2 with a slightly different filename. The dir1 files
>> >> are named like a-1.j
On Wednesday 25 June 2008, Grant wrote:
> >> Feel free to ignore me here, but if anyone could whip out a quick
> >> script for this I would really appreciate it.
> >>
> >> I need to move any files from dir1 to dir2 if they don't already
> >> exist in dir2 with a slightly different filename. The di
Grant asks:
> Thanks guys, can you tell me how to execute this? Put it in a file
> and './file' I think? Should I have special stuff at the top of the
> file?
Yes, a '#!/bin/bash', it you want top have thsi as a script. You need to
make it executable, too: chmod +x file
But you can also leav
>> Feel free to ignore me here, but if anyone could whip out a quick
>> script for this I would really appreciate it.
>>
>> I need to move any files from dir1 to dir2 if they don't already
>> exist in dir2 with a slightly different filename. The dir1 files are
>> named like a-1.jpg and the dir2 fi
On Wednesday 25 June 2008, 17:08, Grant wrote:
> Feel free to ignore me here, but if anyone could whip out a quick
> script for this I would really appreciate it.
>
> I need to move any files from dir1 to dir2 if they don't already exist
> in dir2 with a slightly different filename. The dir1 file
On Wednesday 25 June 2008, Grant wrote:
> Feel free to ignore me here, but if anyone could whip out a quick
> script for this I would really appreciate it.
>
> I need to move any files from dir1 to dir2 if they don't already
> exist in dir2 with a slightly different filename. The dir1 files are
>
Grant asks:
> Feel free to ignore me here, but if anyone could whip out a quick
> script for this I would really appreciate it.
Whipped. Be sure to test it, because I did not :) Remove the echo statement
when you are sure it works.
> I need to move any files from dir1 to dir2 if they don't alre
Feel free to ignore me here, but if anyone could whip out a quick
script for this I would really appreciate it.
I need to move any files from dir1 to dir2 if they don't already exist
in dir2 with a slightly different filename. The dir1 files are named
like a-1.jpg and the dir2 files are named lik
12 matches
Mail list logo