Edit: And feel free to move this to whatever forum it best belongs in. I wasn't sure where to post it.
This post has been edited by E-66: 19 November 2009 - 04:03 PM
Posted 19 November 2009 - 04:01 PM
This post has been edited by E-66: 19 November 2009 - 04:03 PM
Posted 19 November 2009 - 04:16 PM
Posted 19 November 2009 - 04:40 PM
Yzöwl, on Nov 19 2009, 05:16 PM, said:
Posted 19 November 2009 - 05:20 PM
Quote
ShowSubFolders Fso.GetFolder(".")
Quote
ShowSubFolders Fso.GetFolder("C:\SomeFolder")
Quote
Option Explicit
Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")
Dim SubFldr, Ts, Txt
Txt = Fso.GetFolder(".").Path & "\DirectoryList_" & Fso.GetFolder(".").Name & ".txt"
Set Ts = Fso.CreateTextFile(Txt)
Ts.WriteLine Space(1) & Now
ShowSubFolders Fso.GetFolder(".")
Ts.Close
CreateObject("Wscript.Shell").Run("notepad " & Chr(34) & Txt & Chr(34)),1,True
Function ShowSubFolders(Folder)
For Each SubFldr in Folder.SubFolders
'-> Checks To See If Folder Size = 0
If SubFldr.Size = 0 Then
'-> Code To Do The File Copy Here
Ts.WriteLine " Empty Folder " & SubFldr.Path
End If
ShowSubFolders SubFldr
Next
End Function
Posted 19 November 2009 - 07:06 PM
This post has been edited by E-66: 19 November 2009 - 07:07 PM
Posted 20 November 2009 - 10:34 AM
Quote
'-> Code To Do The File Copy Here Ts.WriteLine " Empty Folder " & SubFldr.Path
Posted 20 November 2009 - 04:59 PM
gunsmokingman, on Nov 20 2009, 11:34 AM, said:
Posted 20 November 2009 - 05:40 PM
Quote
Option Explicit
'-> Objects For Script
Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")
'-> Varibles For Script
Dim FileCopy, FileName, SubFldr
'-> Path To File
FileCopy = "C:\Home\Small.wav"
'-> Split To Get Only EG FileName(2) = Small.wav
FileName = Split(FileCopy,"\")
'-> Parent Folder WildCard
ShowSubFolders Fso.GetFolder(".")
'-> Parent Folder Full Path
' ShowSubFolders Fso.GetFolder("E:\ThisFolder\TheNextFolder\ETC")
Function ShowSubFolders(Folder)
For Each SubFldr in Folder.SubFolders
'-> Checks To See If Folder Size = 0
If SubFldr.Size = 0 Then
'-> Code To Do The File Copy Here
Fso.CopyFile FileCopy, SubFldr.Path & "\" & FileName(2),True
End If
ShowSubFolders SubFldr
Next
End Function
Posted 20 November 2009 - 07:19 PM
This post has been edited by E-66: 21 November 2009 - 06:12 AM
Posted 22 November 2009 - 01:38 PM
@ECHO OFF & SETLOCAL ENABLEEXTENSIONS DISABLEDELAYEDEXPANSION
IF [%1]==[] (SET _=%~DP0) ELSE (SET _=%~1)
FOR /D /R "%_%" %%# IN (*) DO CALL :GL_ %%#
GOTO :EOF
:GL_
SET "_=F"
FOR %%# IN ("%*\*") DO GOTO :EOF
COPY "X:\PathTo\FileToCopy.ext" "%*"
You will change "X:\PathTo\FileToCopy.ext" in the bottom line to the full name and path of the file you wish to copy. If FileToCopy.ext is located within the same drive as the batch file, you can replace X: with %~D0. If the file is in the same directory as the batch file it can simply state the filename with extension, e.g."FileToCopy.ext".
Posted 24 November 2009 - 02:27 PM
Posted 24 November 2009 - 03:22 PM
Tripredacus, on Nov 24 2009, 08:27 PM, said:
Posted 24 November 2009 - 04:53 PM