1.

Solve : Find and Move a File?

Answer»

Hi

I want to create a bat file to do the FOLLOWING:

Firstly - Search a location C:/Folder1 for a file prefixed with letters eg CH12345

Possilbly using FIND, but I,m not familar with that command

Secondly - Send that file to another location ie C:/Folder2 and remove it from orignal location.

Not sure if the next step can be done, but it not totally required
Create an email and/or attach the file to the email?
Quote

Firstly - Search a location C:/Folder1 for a file prefixed with letters eg CH12345

So you're searching inside folder1 for any file that begins with CH ?


Quote
Secondly - Send that file to another location ie C:/Folder2 and remove it from orignal location.

for this you would do:


Code: [Select]move /-y C:/Folder1\Ch12345 C:\Folder2

That's how it works if I'm not mistaken.

You can't send an email using plain batch file. Use Blat.

If you don't want to download blat do:

Code: [Select]start mailto:[emailprotected]



Which will open up the email window. But the user must attach the file himself and click send. Thanks


So you're searching inside folder1 for any file that begins with CH ? Yesalso start mailto: works but opens OUTLOOK, how can i get to open lotus notes Quote
how can i get to open lotus notes


Well if this is a program, you just WRITE the path to lotus notes instead of writing start mailto:.
If it is a web program, using start type the url (link, found in address bar), then it will open the default browser.


Quote
So you're searching inside folder1 for any file that begins with CH ? Yes.



In that case, do this:

Code: [Select]move /-y C:\Folder1\CH* C:\Folder2

Which the * represents a wild card. If I'm not mistaken, the wild card will represent... Anything really.
Hope that helped. C:/ should be C:\ above.I always forget which way the slashes go.Hi Folks

Thanks for the help.

However

How can I move Multiple Files to one location;


Move all files prefixed with TE to new location
move "C:\Admin\Test Process Batch Files\Source\TE*.zip"

C:\Admin\Test Process Batch Files\Destination

ERROR is: Cannot Move Multiple Files to Single File

How can I work around this, as I will always have multiple files prefixed the same that need moving to same locationQuote from: petreli on March 03, 2009, 08:47:18 AM
Hi Folks

Thanks for the help.

However

How can I move Multiple Files to one location;


Move all files prefixed with TE to new location
move "C:\Admin\Test Process Batch Files\Source\TE*.zip"

C:\Admin\Test Process Batch Files\Destination

Error is: Cannot Move Multiple Files to Single File

How can I work around this, as I will always have multiple files prefixed the same that need moving to same location

this way how you want to move files
Code: [Select]C:\Admin\Test Process Batch Files\Destinationmeans that they will copy to file Destination but with no extension
so you must show that you want copy to dictory
Code: [Select]C:\Admin\Test Process Batch Files\Destination\Quote from: petreli on March 03, 2009, 08:47:18 AM
Hi Folks

Thanks for the help.

However

How can I move Multiple Files to one location;


Move all files prefixed with TE to new location
move "C:\Admin\Test Process Batch Files\Source\TE*.zip"

C:\Admin\Test Process Batch Files\Destination

Error is: Cannot Move Multiple Files to Single File

How can I work around this, as I will always have multiple files prefixed the same that need moving to same location

the basic syntax of move is

move filespec destination

So you do
Code: [Select]move "C:\Admin\Test Process Batch Files\Source\TE*.zip" "C:\Admin\Test Process Batch Files\Destination"Hi

I have tried this, I think the error I am receiving is means I cannot move files of the same prefix to the same location?

"Cannot move Multiple files to a Single file" is the error

What i'm trying to do is move multiple files to the same location not fileHmmm Me thinks that Copy is a better option, SEEMS to work better, but have to delete the files from source folder, but is safer if theres a problemQuote from: petreli on March 05, 2009, 05:39:20 AM
Hi

I have tried this, I think the error I am receiving is means I cannot move files of the same prefix to the same location?

"Cannot move Multiple files to a Single file" is the error

What i'm trying to do is move multiple files to the same location not file

Does the folder called Destination exist?
Hi Dias de verano

Yes destination file existsQuote from: petreli on March 06, 2009, 05:29:29 AM
Hi Dias de verano

Yes destination file exists

That is not what I asked. Read my question again.


Discussion

No Comment Found