使用txt列表复制,重命名并保存在新文件夹中 [英] Copy, Rename and save in new folder, using txt list
本文介绍了使用txt列表复制,重命名并保存在新文件夹中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请你帮忙
我想创建一个脚本,从列表中复制文件,重命名文件并保存到新位置。我正在使用自动脚本,请参阅下面的脚本
选项( < span class =code-string> TrayIconDebug, 1 )
$ S_running = find-copy-photos;命名脚本
如果 WinExists($ S_running)然后
MsgBox( 0 , AutoIt, 查找和复制照片的脚本已在运行)
退出
EndIf
AutoItWinSetTitle($ S_running)
$ FileName = FileOpenDialog( 选择包含要查找和复制的照片列表的文件, C:\ temp \, 文本文件(* .txt))
如果 @error 然后 退出
$ FileNameArray = StringSplit(FileRead($ FileName),@ CRLF, 1 )
$ PhotoFolder = FileSelectFolder( 选择顶级包含照片的文件夹。, )
如果 @error 然后 退出
$ search = FileFindFirstFile($ PhotoFolder& \ *。*)
如果 $ search = -1 那么
MsgBox( 0 , 错误, 没有文件/目录与搜索模式匹配)
退出
EndIf
1
Local $ file = FileFindNextFile( $ search $ b b 如果 @error 那么 ExitLoop
对于 $ i = 1 $ FileNameArray [< span class =code-digit> 0 ]
如果 $ file = $ FileNameArray [$ i] 然后
FileCopy($ PhotoFolder& \& $ file,@ DesktopDir& \ output \, 8 )
$ FileNameArray [$ i] =
EndIf
下一步
WEnd
对于 $ i = 1 To $ FileNameArray [ 0 ]
如果 $ FileNameArray [$ i]<> 然后
InputBox ( 错误, 找不到:,$ FileNameArray [$ i])
如果 @error = 1 然后 退出
EndIf
下一步
运行( explorer.exe& @DesktopDir& \output \)
解决方案
S_running = find-copy-photos;将脚本命名为
如果 WinExists (
S_running)然后
MsgBox( 0 , AutoIt, 查找和复制照片的脚本已在运行)
退出
EndIf
AutoItWinSetTitle(
S_running)
Please can you help
I want to create a script that copies a file from a list, renames the file and saves in a new location. I am using Auto Script see below script
Opt("TrayIconDebug", 1) $S_running = "find-copy-photos" ;name the script If WinExists($S_running) Then MsgBox(0, "AutoIt", "The script to find and copy photos is already running") Exit EndIf AutoItWinSetTitle($S_running) $FileName = FileOpenDialog("Select the file that contains the list of photos to find & copy", "C:\temp\", "Text File (*.txt)") If @error Then Exit $FileNameArray = StringSplit(FileRead($FileName), @CRLF, 1) $PhotoFolder = FileSelectFolder("Select the top level folder that contains the photos.", "") If @error Then Exit $search = FileFindFirstFile($PhotoFolder & "\*.*") If $search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf While 1 Local $file = FileFindNextFile($search) If @error Then ExitLoop For $i = 1 To $FileNameArray[0] If $file = $FileNameArray[$i] Then FileCopy($PhotoFolder & "\" & $file, @DesktopDir & "\output\", 8) $FileNameArray[$i] = "" EndIf Next WEnd For $i = 1 To $FileNameArray[0] If $FileNameArray[$i] <> "" Then InputBox("Error", "Could not find:", $FileNameArray[$i]) If @error = 1 Then Exit EndIf Next Run("explorer.exe " & @DesktopDir & "\output\")解决方案S_running = "find-copy-photos" ;name the script If WinExists(
S_running) Then MsgBox(0, "AutoIt", "The script to find and copy photos is already running") Exit EndIf AutoItWinSetTitle(
S_running)
这篇关于使用txt列表复制,重命名并保存在新文件夹中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文