Author Topic: vl-file-copy and vl-file-systime  (Read 2643 times)

0 Members and 1 Guest are viewing this topic.

fieldguy

  • Mosquito
  • Posts: 1
vl-file-copy and vl-file-systime
« on: April 03, 2012, 07:54:49 PM »
I am using acad 2009 and vlisp to copy files from network to local folders. It works great except the copied files have todays date and time.  The end result will be used to update semi-dynamic files based on the network versions so comparing file dates and times is a requirement.  Is there a way to copy the file and maintain its original attributes?

TIA 

BlackBox

  • King Gator
  • Posts: 3770
Re: vl-file-copy and vl-file-systime
« Reply #1 on: April 04, 2012, 01:41:40 AM »
Some other options include:

Xcopy with /k
FileSystemObject CopyFile() Method
System.IO.File.Copy() ... Which is really Kernel32.dll's CopyFile

That last one would require a .NET LispFunction Method.
"How we think determines what we do, and what we do determines what we get."

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: vl-file-copy and vl-file-systime
« Reply #2 on: April 04, 2012, 02:21:14 AM »
Good point,
The xcopy can be run through a startapp call (though it might open a command console window). The FileSystem can the run through  (vlax-get-or-create-object "Scripting.FileSystemObject").

If you go the DotNet route with the System.IO namespace, you might even be able to modify the creation/modification dates after the fact.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

ronjonp

  • Needs a day job
  • Posts: 7531

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

BlackBox

  • King Gator
  • Posts: 3770
Re: vl-file-copy and vl-file-systime
« Reply #5 on: April 04, 2012, 11:55:46 AM »
Good point,
The xcopy can be run through a startapp call (though it might open a command console window). The FileSystem can the run through  (vlax-get-or-create-object "Scripting.FileSystemObject").

Thanks.

To paraphrase "The Most Interesting Man in the World:" I do not use batch files that often, but when I do, I prefer to display the console.

Pseudo code:
Code: [Select]
@echo off

title Your title goes here

if exist Z:\ goto :yes
goto :no

:yes
echo/
echo/
echo Working, please wait...

xcopy "source\*.*" "destination" /d /e /h /k /q /r /y
cls
color 2f

echo/
echo/
echo Working, please wait... Done
echo/
echo/

pause

goto :end

:no
color 4f

echo/
echo/
echo No worky, fix something and try again.
echo/
echo/

pause

:end

If you go the DotNet route with the System.IO namespace, you might even be able to modify the creation/modification dates after the fact.

I've been meaning to put together a small library of LispFunction Methods for the System.IO.File Class, maybe I'll do that here shortly.
« Last Edit: April 04, 2012, 12:19:38 PM by RenderMan »
"How we think determines what we do, and what we do determines what we get."