• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 246
  • Last Modified:

Need a script or batch file that checks a folder for files and reports finding

I have over 1000 folders that have 1 subfolder inside them.  I need to run a script or a batch against those folders to check for any files that are located inside of the subfolders and then create a text file with the findings.  So here is an example of a folder location.

\\computername\d$\audio\01E\inbox\

I need to scan the inbox folder to see if there are any files inside of it.  If so, then a text file needs to report what files it found.  I can supply a list of the folder paths, or the scaript (batch) could run in the root of the folders (d:\audio\) of the computer and just scan every folder inside of that root.  Again, it is the inbox folder I am interested in.
0
murryc
Asked:
murryc
  • 2
  • 2
1 Solution
 
canaliCommented:


Find all file in d:\audio\*\inbox an d put in listInboxFiles.txt
d:
cd d:\audio\
echo. >listInboxFiles.txt
for /f %%a in ('dir /b /a:d ') do (
  echo ---file found in %%a\inbox     >>listInboxFiles.txt
  dir  /b %%a\inbox                          >>listInboxFiles.txt
  echo ---end list files in %%a\inbox >>listInboxFiles.txt
 )


Gas
0
 
gsgiCommented:
Gas : What is a good reference on batch files like that?

I recently found a bat file script that will find the newest x # of files in a directory but I can't read it.
It uses almost the same syntax as above  for /f %a %a ('dir .... ) do (

thanks,

gsgi
0
 
murrycAuthor Commented:
canali

How can we alter your script to scan the folders from a remote computer using UNC?
0
 
canaliCommented:

assuming the remote server name is : audiosrv
assuming that the disk in audiosrv to be searched is : e:\
assuming the remote folder is e:\audio
assuming u have the privileges to connet the share

 
net use Q: \\audiosrv\e$\audio
Q:

echo. >listInboxFiles.txt
for /f %%a in ('dir /b /a:d ') do (
  echo ---file found in %%a\inbox     >>listInboxFiles.txt
  dir  /b %%a\inbox                          >>listInboxFiles.txt
  echo ---end list files in %%a\inbox >>listInboxFiles.txt
 )

Gas
0
 
murrycAuthor Commented:
Perfect!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now