Home > Software engineering >  VBS for folders specified after a modification time so file to the specified directory
VBS for folders specified after a modification time so file to the specified directory

Time:09-19

For example, a folder: newfolder
There is a file a. d. ll modify time: 2018/7/15 18:00
B.d ll modify time: 2018/7/16 3:00
C.d ll modify time: 2018/7/15 15:00
Etc documents such as

I want to take modification time include all documents after 2018/7/15 15:00 to generate a new folder and according to the specified path:
Version \ folder1 \ a. d. ll
Version \ folder2 \ b.d ll
Version \ folder2 \ c.d ll

The time here is how to determine a bit better, it is first over all the time, or when taking file each judgment about a
There are a lot of files under the newfolder

CodePudding user response:

System (" dir/b/a - d c: \ \ *. * & gt; D: \ \ allfiles TXT ");
//read file d: \ \ allfiles TXT content of C: \ \ under the names of all files
System (" dir/b/a - d/s c: \ \ *. * & gt; D: \ \ allfilesinsub TXT ");
//read file d: \ \ allfilesinsub TXT content that is C: \ \ under the names of all files contain subdirectories
System (" dir/b/active directory c: \ \ *. * & gt; D: \ \ alldirs TXT ");
//read file d: \ \ alldirs TXT content of C: \ \ under the names of all the subdirectories
Please remember, can use the shell command to get the file and folder information or manipulate files, folders had better use the shell command to get or operation, and don't use all sorts of API access to or operation, because when it comes to illegal folder name or illegal filename or illegal file length, illegal file date, compressed file, link files, sparse file... All sorts of unexpected situations, such as API can deal with incomplete or into an infinite loop, and shell commands not,
If disrelish black window system that the system ("... ") is replaced by WinExec (" CMD/c... ", SW_HIDE);

CodePudding user response:

The dir command enumeration file not wordy, asked baidu,
Only say how to take the specific file below a few date attribute

 
Set the fs=CreateObject (" Scripting. FileSystemObject ") 'create FileSystemObject object
Set f=fs. GetFile (" b: \ 123. TXT ") 'return path to the File specified by the corresponding File object
MsgBox f.D ateCreated 'creation time
MsgBox f.D ateLastModified 'last modified date and time the file
MsgBox f.D ateLastAccessed 'last visit to the date of the file
  • Related