Total Commander Forum Index Total Commander
Форум поддержки пользователей Total Commander
Сайты: Все о Total Commander | Totalcmd.net | Ghisler.com | RU.TCKB
 
 RulesRules   SearchSearch   FAQFAQ   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Single Post  Topic: Копирование фотографий с сортировкой по дате 
Author Message
gre_vit



PostPosted: Sun Jan 24, 2010 01:23    Post subject: Reply with quote

Здравствуйте. Вопрос хороший, т.к. на сайте http://www.tckb.ru задача, даже с учетом всего-лишь даты создания файла, не решена полностью (в разделе автоматизации). Решил себя попытать в этом деле первый раз. Вот, что вышло при переделке скрипта:
Code:

If WScript.Arguments.Count = 0 Then
MsgBox "Не указаны параметры!", vbOKOnly + vbError, "Внимание!"
Wscript.Quit
End If

Dim TempFile, FSO, SelFile
Set FSO = CreateObject("Scripting.FileSystemObject")
Set TempFile = FSO.OpenTextFile(WScript.Arguments(0), 1)

Dim FileName, FilePath, DashInName, NewFilePath, FileDateModif

Do While Not TempFile.AtEndOfStream
   Set SelFile = FSO.GetFile(TempFile.ReadLine)
   FileName = FSO.GetBaseName(SelFile)
   FileDateModif = Left(SelFile.DateLastModified, 10)
   FilePath = SelFile.ParentFolder
   If WScript.Arguments.Count > 1 Then
      NewFilePath = WScript.Arguments(1) & FileDateModif
   Else
      NewFilePath = FilePath & "\" & FileDateModif
   End If
   If Not FSO.FolderExists(NewFilePath) Then
      FSO.CreateFolder(NewFilePath)
   End If
   If Not FSO.FileExists(NewFilePath & "\" & FileName) Then
      FSO.MoveFile SelFile, NewFilePath & "\"
   Else
      MsgBox "Уже существует файл " & FileName & " в папке " & NewFilePath, vbOKOnly + vbExclamation, "Внимание!"
   End If
Loop

Set TempFile = Nothing
Set FSO = Nothing
Set SelFile = Nothing
Wscript.Quit

Работает. Главное, как указано, необходимо в параметры создаваемой кнопки прописать параметры %L "%T".
Ах да, в данном скрипте используется дата последнего изменения файла. Сделано для того, чтобы названия папок были датами создания.
View user's profile Send private message


Powered by phpBB © 2001, 2005 phpBB Group