Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: how do I? moving files without overwriting and still suppresing prompt

176 views
Skip to first unread message
Message has been deleted

foxidrive

unread,
Jun 26, 2008, 10:59:47 AM6/26/08
to
On Thu, 26 Jun 2008 14:26:31 +0100, nob...@home.here.com wrote:

>I want to move a load of files into alpha sorted directories. Often
>the list of files I want to move is well over 5000 and I am currently
>using the /-y switch.
>
>However, every time it has a filename conflict, it asks me if I want
>to overwrite. After doing it for x hundred files, this gets a bit
>tedious pressing 'N' and then ENTER for each one.
>
>I want to automatically allow it to say no to overwriting so I can
>rename the remaining files and re-run the batch file.
>
>From my base directory, the structure is:
>BASE
>......SORTED
>...............A
>...............B
>...............C
>etc to Z...then
>..............ZIPS
>..............MOVIES
>..............NUMERIC

How about appending a number automatically to files with the same name?

If not, in your code you would do something like this fro the copy command:

if not exist "%filepath%\%filename%" copy "%filename%" "%filepath%\"

billious

unread,
Jun 26, 2008, 1:09:18 PM6/26/08
to

<nob...@home.here.com> wrote in message
news:8h57645d07emshlbl...@4ax.com...

>I want to move a load of files into alpha sorted directories. Often
> the list of files I want to move is well over 5000 and I am currently
> using the /-y switch.
>
> However, every time it has a filename conflict, it asks me if I want
> to overwrite. After doing it for x hundred files, this gets a bit
> tedious pressing 'N' and then ENTER for each one.
>
> I want to automatically allow it to say no to overwriting so I can
> rename the remaining files and re-run the batch file.
>
> Some of these files are indeed copies but others are different files
> with the same filename. I don't want to overwrite existing files with
> a different one and want to suppress the overwrite completely just in
> case.

>
> From my base directory, the structure is:
> BASE
> ......SORTED
> ...............A
> ...............B
> ...............C
> etc to Z...then
> ..............ZIPS
> ..............MOVIES
> ..............NUMERIC
>
> I move the zips and movies first and then all files that start with A
> then B and so on to Z. Finally any filenames starting with a numeric
> are moved to the numeric directory.
>
> Suggestions anyone? Or maybe an application that will enable me to do
> this without batch processing.
>
> Thanks.

I believe that a template for what you are looking for may be something
like: (one line)


for %%i in (a b c) do if exist \sourcedir\%%i*.* for %%q in
(\sourcedir\%%i*) do if not exist "\destdir\%%~nxq" if not exist
"\destdir\%%~snxq" ECHO move "%%~fq" \destdir\


Where the ECHO is for safety.


That is, for matching filenames (if they exist) make sure that neither the
long filename nor the short filename exists in the destination directory and
if neither exists, move the file.

I've observed however that wit certain "nasty" filenames (containing
multiple-% for instance) the move is skipped, and also that sometimes the
file is COPIED, not moved - which I've seen before with the MOVE command.


Message has been deleted

Todd Vargo

unread,
Jun 28, 2008, 2:25:20 PM6/28/08
to

<nob...@home.here.com> wrote in message
news:tjib645kkah5j1euo...@4ax.com...
> I thank you.
>
> I'll go with your suggestion as the one from Billious seems a little
> too complicated for what I need. However, I would move rather than
> copy so I am left only with the files where conflicts have occurred.
>
> Since I've searched the net for a suitable program to automate this
> process without success, I've decided to dust off my VB skills and
> write one for the freeware market. Maybe a more elaborate shareware
> version later.

Have you looked at XXCOPY? I believe the /BB switch does what you want and
xxcopy does a whole lot more.

--
Todd Vargo
(Post questions to group only. Remove "z" to email personal messages)

jameshanley39

unread,
Aug 6, 2008, 8:58:03 AM8/6/08
to
On Jun 26, 3:59 pm, foxidrive <got...@woohoo.invalid> wrote:
> On Thu, 26 Jun 2008 14:26:31 +0100, nob...@home.here.com wrote:
> >I want to move a load of files into alpha sorted directories. Often
> >the list of files I want to move is well over 5000 and I am currently
> >using the /-y switch.

/-y is the default. to prompt.

/- means don't. like dir /o-h all non hidden files, instead of
dir /oh

/y "supporesses the prompt and confirms it. It says yes to the prompt
and doesn't show the prompt.

>
> >However, every time it has a filename conflict, it asks me if I want
> >to overwrite. After doing it for x hundred files, this gets a bit
> >tedious pressing 'N' and then ENTER for each one.
>
> >I want to automatically allow it to say no to overwriting so I can
> >rename the remaining files and re-run the batch file.
>

sounds like another way to solve the problem would be

md asdf


::move out all files with the same name in src and dest to the asdf
directory
move allthosefiles asdf
move *.* \dest <-- moves all (these have different names), to \dest

rename accordingly.
ren *.* R*.* <-- something like that or one by one

you may want to test that no files in dest share those names

move *.* \dest

..
I was thinking about echo nnnnnn| xcopy ...
it works for echo sddssdf | dir /p

Fortunately , is a simple Y or N, and not a really stupid prompt of F
or D.
Because the dest directory exists.

I did try
c:\adsf>echo n| xcopy *.* \asdf2

that was weird, it didn't copy files a and b, but it copied some
others. then it stopped (*.* should include a and b, in DOS.. And,
* doesn't do them either, though i think one is meant to use *.*)
/c didn't help it , /c is meant to continue if errors occur.

0 new messages