|
Each contribution is licensed to you under a License Agreement by its owner, not Microsoft. Microsoft does not guarantee the contribution or purport to grant rights to it.
|
Categories |
Move Files from a Floppy Disk(Community)
Script Code
VBScript
'This program copies files from A:\ to
'a location of the users choice
'also each time the program is run
'with the same destination path,
'the files will be put in a folder
'with an index name, ex 1 or 2
'to change the save location change this variable \/
'*******************************************************
save = "\\wmsfs\allwms\floppy"'<-----------------------change
'*******************************************************
'to change the save location change this variable /\
'network loacation \\wmsfs\allwms\floppy
'start of main line of code
set fso = createobject("scripting.filesystemobject")
on error resume next
'if save\index exists, check next index, loop until dir doesnt exist
'create directory set directory as global var
for x = 1 to 250
if fso.folderexists(save&"\"&x) then
else
fso.createfolder(save&"\"&x)
save=save&"\"&x
exit for
end if
next
start 'this calls the first sub
sub start
'get root files
set root = fso.getfolder("A:\")
for each file in root.files
file.copy save&"\"&file.name
next
makesubs("A:\")
end sub
'create subfolder directories
sub makesubs(path)
set bind = fso.getfolder(path)
for each subfld in bind.subfolders
fso.createfolder save&"\"&subfld.name
getfiles(subfld.path)
next
end sub
'copy files from subfolders from A:\ to save
sub getfiles(path)
set directory0 = fso.getfolder(path)
newpath = mid(path,3,len(path))
for each f in directory0.files
f.copy save&newpath&"\"&f.name
next
end sub
msgbox "you may switch diskettes now",vbokonly,"Created by Ken Kellestine"
Platforms
For online peer support, join
The Official Scripting Guys Forum!
To provide feedback or report bugs in sample scripts, please start a new discussion on the Discussions tab for this script.
Disclaimer
The sample scripts are not supported under any Microsoft standard support program or service. The sample scripts are provided AS IS without warranty of any kind. Microsoft further disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample scripts and documentation remains with you. In no event shall Microsoft, its authors, or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample scripts or documentation, even if Microsoft has been advised of the possibility of such damages.
Be the first to create a discussion.
|