Jump to content

Recommended Posts

Posted

Can anyone give me some pointers with the following?

 

I'm after a script that when run will detect a USB flash drive and copy a file off of it to another location.

 

I've got 32 flash drives to copy a file off and I don't fancy doing it all manual so a plug in and click would be nice lazy way of doing things!

 

TIA

 

Mike

Posted

From the sounds of it you dont need a script to detect the presence of a USB Drive as the drive should have the same drive letter each time so long as you unplug one before you plug in another. With that in mind a simple bat/cmd script should suffice... something like:

 

copy [Driveletter]:\*.* c:\temp /y

 

Where Driveletter is the drive letter of the flash drive.

Posted

@ajbritton: am i wrong in thinking that removable drives are associated with the first avaible drive letter and unless you have drive that change their drive letter or you plug in more devices, then the drive letter should remain the same.... shouldnt it?

 

@NetworkGeezer: Well he did say he was going to plug them in 1 at a time..

Posted

Wonder how much time you would actually save by using the script and doing it manually. That is manually you would plug in, ctrl+a (in usb drive), copy and paste in desired location... and automated(ish) plug in and double click bat/cmd. Would think its only a fraction quicker.

 

Perhaps you could plug in a few at a time and use a script to copy all of em at once or sequentially to desired location.. would be less tedious and possibly quicker?

Posted

You're right and that thought did occur to me but if preventing errors is a concern then automation is the way to go.

 

Can I ask what thisu collecting for Kwyjibo? Are you collecting work from student laptops?

Posted
Reports from teachers, they need to be backed up so was just looking looking for a quick and easy way of doing it.
Posted

OK so this kind of thing would have to be done periodically so scripting would not be a complete waste of time.

 

The really geeky thing to do would be to be generate the destination file name by indetifying the teacher from the GUID of the USB drive.

 

For now you jstu have to rely on command line arguments to the script name.

 

 

 cscript teacher-report-back-script.vbs  [uSB-drive letter]

Posted

You could prompt for a name either each time the script is executed (assuming you run it once per USB drive), or each time a new file is detected. The script could then use the supplied name to either create a subfolder, or to modify the filename accordingly.

 

Thinking further, how about this...

 

Script checks for an INI file on the root of the USB drive (eg OWNER.INI)

- If the INI file is found, the script pulls the teachers name out of it

- If the INI file is NOT found, the script prompts for the owner's name and then stores it in OWNER.INI on the drive.

The script now knows who the drive belongs to and will remember it for next time.

The script now copies the required file, modifying the name to be something like JoeBlogss_ReportDoc.doc

Posted

Attached is a hastily cobbled together AutoIt script. It's not compiled so AutoIt will need installing wherever you need to run it.

 

Basically, it does what I suggested in my previous post. Feel free to use or adapt it in any way you see fit. There is plenty of room for improvement here!

Posted

Nice solutions guys.. like it :D

 

I would be tempted to just say to the teachers, 'Here is a location on the shared drive Ive created for you, copy all your work there from your usb stick or it wont get backed up' :twisted: Also begs the question why arent these files in their home directory where it would be backed up anyway.

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



×
×
  • Create New...