We help IT Professionals succeed at work.

moving files from one dir to another

patrickm3
patrickm3 asked
on
Is there a way that I can move a file from one dir to another after and only after it is stabilized?????

I currently use an asp page to move files to other directories--but I would like to do it automatically, but only after the file has stabilized,

patrick
Comment
Watch Question

Commented:
how would you be able to tell if a file has stabilized?

Commented:
you could create a vbs file that uses the file system object to check files older than a set time.  copy the file to other location if that version of file is not there already

then schedule the vbs file to run using the AT scheduler

Author

Commented:
thats way out of my league----

how would I get started--the time stamp for a file is assigned after it is stable??

can we set it to move 10 seconds after it is done moving?

do you know of any resources that could get me in the right direction??

Commented:
I was making the assumption that you would know a file is stable after a certain period of time.  Maybe more information would help clarify this.  I was thinking that after a week of no changes, a file could be viewed as stable.  what kind of files are we talking about and what are you defining as stable?

Author

Commented:
files from advertising get saved to a drive for image swapping---this is a lengthy process on the users' machines because of network traffic and server resources--

I see that a much better way to go, and the reason for my other questions that you helped me with, is that the user can save their file to a nt machine and then that machine can do the save to the unix network for image swapping--this clears the users' screens in a 1/3 of the time--

it also allows them to repurpose the file for proofing without resending  saving 50% of the time.



I need to route the file to the nt machine and setup an asp page that moves the file to another location as soon as its done moving -- or every 10 minutes with only stable files---


maybe files that are transferring won't be moved--I don't know

that would be perfect!!!

any ideas???

Commented:
ok, here is what I would attempt.

create a page that looks in your folder for files that have not changed in 3 minutes.  the modified date does not change while file is being transfered.  The size does not change while the file is being transfered.  you are stuck waiting for a set period of time to allow complete file transfer.  If three minutes it plenty of time to allow complete file transfers, then use this time.  Copy any files that have older times than the time you have set.  At this point I would also do clean up if possible.  if file is older than say 30 minutes, delete it.

create an asp page to accomplish what you need using the file system object.



when you get the page working properly then you can make the conversion to a vbs file.  to convert your asp file to a vbs file, you only need to change any server.createobject() calls to use createobject() and change the file extension.

then schedule the vbs file to run every 5 minutes.  one of the links I posted discusses how to do this.

John

Author

Commented:
I don't believe the links suggest how a file can move unless its scheduled daily, weekly that kind of thing--set intervals--


how would I go about comparing server time to file timestamps to launch the vbs?
Commented:
To use AT, type something like this at the command prompt:
AT 00:00 /every:M,T,W,Th,F,Sa,Su "C:\path to your script\script.vbs"

the at scheduler will fire off at the time intervals you specify.

checking the difference in time would just be file.DateCreated or file.DateLastModified compared against now()

Explore More ContentExplore courses, solutions, and other research materials related to this topic.