Jump to content

Can't get filemove or filecopy to work


1bobby
 Share

Recommended Posts

Creating a back up file using ntbackup to the E:dirve (local computer) to H:drive (network) Using the following test code. All it should do is move the backup file from e: to H:

FileMove("E:\DPSIBU\weekly.bkf", "H:\DPSIBU\",1)

sleep(500)

MsgBox(4096,"Done file backup", "ALL",15)

sleep(500)

Exit

It should move the file, display the message and exit. But it locks up the computer and you have to mess with control break several time, then end task to get it to let go. One thing I did notice is if I do a explorer, I don't have any drives mapped. Once it lets loose the drives are mapped?

Nubee trying to learn this stuff, HELP

bobby

Link to comment
Share on other sites

Creating a back up file using ntbackup to the E:dirve (local computer) to H:drive (network) Using the following test code. All it should do is move the backup file from e: to H:

FileMove("E:\DPSIBU\weekly.bkf", "H:\DPSIBU\",1)

sleep(500)

MsgBox(4096,"Done file backup", "ALL",15)

sleep(500)

Exit

It should move the file, display the message and exit. But it locks up the computer and you have to mess with control break several time, then end task to get it to let go. One thing I did notice is if I do a explorer, I don't have any drives mapped. Once it lets loose the drives are mapped?

Nubee trying to learn this stuff, HELP

bobby

looks like it should work to me assuming there is nothing else in your script which you haven't shown us and assuming nothing else is accessing the file you're trying to move.

What happens if you go to the command prompt and type the following line?

Move "E:\DPSIBU\weekly.bkf" "H:\DPSIBU

If that works then your script should work, provided there is no other process which has opened the file.

In case you aren't aware, it's easier for people to read your script if it gets to more lines than just the few you posted if you enclose the lines in code tags [TAG] before and [/TAG] after the lines where TAG can be code or autoit. (Autoit tags have often caused problems in this forum so I stick to code.)

Btw, the sleep(500) lines are not needed.

Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Mmm.. three things:

1º- From help file:

FileMove ( "source", "dest" [, flag] )

source The source path and filename of the file to move. (* wildcards are supported)

dest The destination path and filename of the moved file. (* wildcards are supported)

The destination directory must exist.

So you should try:

FileMove("E:\DPSIBU\weekly.bkf", "H:\DPSIBU\weekly.bkf",1)

Or, if I'm not wrong: (To create the destination directory and overwrite)

FileMove("E:\DPSIBU\weekly.bkf", "H:\DPSIBU\",9)

2º - Did you try doing it manually? With any other file? If you say that the H drive is in a remote computer, you might not have permission to write on the disk...

3º - The file is being used by another application, like Martin said.

The weird thing is that it does work if you move a file the way you are doing it between two directories, so I go for otion 2º, 3º OR the destination directory doesn't exist and you have to use flag 9

Edited by Nahuel
Link to comment
Share on other sites

Looks like the problem in that it is trying to move the file over a wan. Just got back to the shop and tested in on the network and it will work just fine. The wan is a T! and has 15 of 20 users at the off site locations. Any suggestions?

Link to comment
Share on other sites

Looks like the problem in that it is trying to move the file over a wan. Just got back to the shop and tested in on the network and it will work just fine. The wan is a T! and has 15 of 20 users at the off site locations. Any suggestions?

From what I have read it is not a simple thing to run AUtoIt scripts over a WAN, there is some good information in the FAQs about this:

"Q9. How can I run my script on a remote computer over the network?

A1. The answer to this question depends on how much experience you have in networking. If the target system is a Windows 2000 or Windows XP Pro system that you have administrator access to, then you may use one of the following programs:

PsExec from SysInternals

BeyondExec from BeyondLogic

With either of these programs it is possible to launch any process on a remote system, and even copy your script to the target computer before starting it. Neither these programs nor any others will work with Windows XP Home Edition unless you create a custom "command listener" that you manually install on the target system.

NOTE: Those of you with more advanced programming skills and a little imagination can figure out how to use the service control libraries and srvany.exe to do this same thing without either of the above mentioned programs."

Also is the destionation directory already existing? If it is not the script that you are using may not be able create it, or may not have the permissions to create it.

I tried your script as it is without the destination directory existing and it turned the file I was transfering into a generic file with the name of the directory it was supposed to go into.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...