将excel中的文件名移动到特定文件夹(move files name in excel to a specific folder)
我正在尝试编写一个从excel文件中读取的批处理文件。 然后将它们移动到specique文件夹。
让我们说在excel中,有:
111.txt
222.txt
333.txt
512.txt
我想要一个批处理文件,将文件移动到具有上述名称的特定目录中。
我怎么能实现这一目标? (我使用的是xp,我的目录是D :)
I am trying to write a batch file that reads from excel file. then move them to a specique folder.
lets say in the excel , there are:
111.txt
222.txt
333.txt
512.txt
I want a batch file that move files into a specific directory that have the above names.
how can I achieve that ? (I am using xp , and I the directory is D:)
原文:https://stackoverflow.com/questions/24303105
更新时间:2021-03-18 15:03
最满意答案
cd /d "d:\files"
for /f %%i in ("C:\where the file resides\file.csv") do (
echo move "%%i" "D:\New\"
)
如果输出似乎正常,则删除echo
cd /d "d:\files"
for /f %%i in ("C:\where the file resides\file.csv") do (
echo move "%%i" "D:\New\"
)
remove the echo if output seems ok
相关问答
你不需要一个宏 - 你可以从CELL函数获取文件路径信息,然后建立一个超链接。 假定该文件在单元格B2中: =HYPERLINK(CONCATENATE(LEFT(CELL("filename",B2),FIND("[",CELL("filename",B2))-1),B2,".pdf"))
You don't need a macro for this - you can get the filepath information from the CELL function, then bui
...
我不确定你发送你的函数的值是什么,但我试着一步一步地运行它,我认为你误解了函数期望的参数。 您的第一行需要修剪FolderPath Source = SharePoint.Files(FolderPath, [ApiVersion = 15])
这里的FolderPath应该是SharePoint站点或托管所需文件的子站点的根目录。 SharePoint.Files返回网站上所有文件的表格。 TheFile = Source{[Name=FileName,#"Folder Path"=Folde
...
如果您不知道有多少目录,我会做这样的事情: Get-ChildItem -Path $mypath -Recurse -File -Filter $extension | ForEach-Object {
if ($_.FullName.IndexOf('\PRO\') -gt 0) {
$Destination = Join-Path -Path $_.FullName.Substring(0,$_.FullName.IndexOf('\PRO\') + 5) -Chil
...
Pl试试这个:根据您的要求更改文件夹。 Sub Copy_Folder()
'This example copy all files and subfolders from FromPath to ToPath.
'Note: If ToPath already exist it will overwrite existing files in this folder
'if ToPath not exist it will be made for you.
Dim FSO As Obje
...
下面我有一个宏,它可以逐个打开文件夹中的所有工作簿,您会注意到我在哪里注释了一个部分,在这里您可以输入您的代码并对给定的工作簿执行操作。 这将遍历文件夹中的每个工作簿,直到没有任何剩余。 Sub ImportMacro()
'PURPOSE: To loop through all Excel files in a user specified folder and perform a set task on them'
Dim wb As Workbook
Dim myPath As Stri
...
我用这些文件模拟了一个目录: Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 4/25/2018 11:07 AM
...
你可以使用sublime来做到这一点。 将所有行从excel复制到sublime,单击Ctrl + A然后按Ctrl + Shift + L.现在您可以编写命令来移动每个文件,例如 - mv C/Users/MyDocs/Datasets/TCD989890123 C/Users/MyDocs/Curated mv C/Users/MyDocs/Datasets/TCD123090909 C/Users/MyDocs/Curated mv C/Users/MyDocs/Datasets/TCD98
...
只需通过标准输出流从DIR命令检索输出。 比Dir$()快得多,不需要任何循环!: Sub Foo()
Dim strFolderName As String
Dim strFileType As String
Dim pasteRange As Range
Dim returnVals As Variant
'// set parameters, change as required
strFolderName = "C:\Users\NAME\Documen
...
cd /d "d:\files"
for /f %%i in ("C:\where the file resides\file.csv") do (
echo move "%%i" "D:\New\"
)
如果输出似乎正常,则删除echo cd /d "d:\files"
for /f %%i in ("C:\where the file resides\file.csv") do (
echo move "%%i" "D:\New\"
)
remove the echo if out
...