Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
FileGetAttributes and Network Drives
#1
Hello all!

I'm trying to use the FileGetAttributes function to get the modified time of a file on a network drive.

I am getting the following error: failed to get file attributes. The system cannot find the path specified. (0x3).

The function seems to work fine with a files on a local drive (i.e. C:\), but always seems to fail for files on a network drive.

Is there a workaround?

BTW, my goal is to rename a file with a timestamp appended (to the original name).

e.g. file.pdf -> file_2020-11-23.pdf

Here is what I have that works well for local files, but fails with files on a network drive.
 
Code:
Copy      Help
FileGetAttributes(f 0 0 t); err out _error.description; ret
t.UtcToLocal
st = t; st.timeformat("_{yyyy-MM-dd}")
fp = f; fp.getpath
fn = f; fn.getfilename
fe = f; fe.GetFilenameExt
f1.from(fp fn st "." fe)
ren f f1

If there is an easier way to do this, please provide a direction to explore.

Thanks!
#2
Use network path like \\computer\folder\....
If using mapped drive letter like K:\..., the macro should run in non-admin process.


Forum Jump:


Users browsing this thread: 1 Guest(s)