File search

  • Thread starter Thread starter millin
  • Start date Start date
M

millin

Hi All,

I want to find a solution for one of our file structure implemented in our
organization.

We are having a Kofax scanner that scans all the incoming documents
(drawings) and place automatically in a network shared folder; this is
ongoing for last 10 years or so. The software does it by copying every 500
files in a single folder so you can image how many number of files are there
in that shared folder, like that we have got 500 folders.

So anybody can give me a quicker solution for finding the obsolete drawings
on each folder by not going to each folder, looking for the pdf documents and
delete one by one looking for the issue numbers.

eg:- Suppose the folder called example-000,the files inside are called
example-000-1.pdf,example-000-2.pdf, example-000-3.pdf, etc(3 is the latest
issue number for that Drawing, I want to delete the rest of the files).

Thanks in advance,

mil
 
millin said:
Hi All,

I want to find a solution for one of our file structure implemented in our
organization.

We are having a Kofax scanner that scans all the incoming documents
(drawings) and place automatically in a network shared folder; this is
ongoing for last 10 years or so. The software does it by copying every 500
files in a single folder so you can image how many number of files are
there
in that shared folder, like that we have got 500 folders.

So anybody can give me a quicker solution for finding the obsolete
drawings
on each folder by not going to each folder, looking for the pdf documents
and
delete one by one looking for the issue numbers.

eg:- Suppose the folder called example-000,the files inside are called
example-000-1.pdf,example-000-2.pdf, example-000-3.pdf, etc(3 is the
latest
issue number for that Drawing, I want to delete the rest of the files).

Thanks in advance,

mil

Your filing system is far from clear - please elaborate, preferably with
some
detailed examples.
 
Example Folder name is XY10529 which is created automatically while we scan
the document with a bar code label XY10529 placed at the back of the incoming
document (ICRN) and all the files inside that folder are XY10529-1,
XY10529-2, XY10529-3, XY10529-4.pdf.(-1,-2,-3 and -4 stands for issue number
or the drawings).This folder is in a network shared server folder.

Our target is to keep only the last issue which is issue number 4 in this
exampleXY10529-4.pdf,and all other files in the folder should be copied in to
a temp folder(keeping the folder hierarchy) for further future reference.

As I mentioned earlier we have got at least 500 of these type of folders and
in each folder drawing files have been saved as <foldername-1.pdf,-2,-3 and
-4.pdf etc)

I hope this is making sense.

Thanks
mil
 
According to your description, you expect this to happen:
- Each folder to contain exactly one file.
- This file should be the one with the highest issue number.
- All other files should be moved to a temp folder.

This might translate into the following pseudo-code, assuming that
your folders are kept in D:\Scanned Files:
1. Move the folder "D:\Scanned Files" to "X:\Temp\Scanned Files",
complete with all subfolders & files.
2. Move the most recent file in each folder back to D:\Scanned Files.

Is this a correct interpretation?
What is the extension of your files?
 
Yes you are almost right.
The file extension is PDF.

If you move the files from the shared folder "<Servername>:\Scanned Files:"
to "X:\Temp\Scanned Files", it will create "chaos" because people are still
accessing this folder and uploading documents from it to another application.

what I want to do is instead of moving the files, copy the files from the
source path to the destination path which is "X:\Temp\Scanned Files", which I
can do; but I don’t know how we can keep the latest issue file in the
"<Servername>:\Scanned Files:" and move the rest of the files in each folder
follwing the folder hierarchy in to a temp folder.

Yes. The main target is to leave the latest issue number at the original
location and move the rest of the files in to the "X:\Temp\Scanned Filesâ€,
following the folder hierarchy, even if it's not possible following the
folder hierarchy it's fine.

Thanks
mil
 
Try the following batch file:
01. @echo off
02. set SourceDrive=D:\Test Folder
03. set Target=E:\Temp Folder
04.
05. for /F "tokens=*" %%* in ('dir /b "%Source%"') do call :Sub %%*
06. del c:\exclude.txt
07. goto :eof
08.
09. :Sub
10. attrib +a "%Source%\%*\*.*"
11. for /F %%b in ('dir "%Source%\%*" /on /b') do echo %%b>c:\exclude.txt
12. xcopy /y /m /exclude:c:\exclude.txt "%Source%\%*\*.*" "E:\Temp\%*\"
13. del "%Source%\%*\*.*" /A:-A /Q

Instructions:
1. Set up a test bed with a number of folders and files.
2. Adjust Lines #02 and #03 to reflect your test bed.
3. Remove all line numbers.
4. Run the batch file.
5. Check if it did what you expected.
6. If yes, adjust Lines 2 and 3 to reflect your production environment.
Warning: Do not retype the code - use copy & paste instead!
 
Hi,

Can I run it using a command prompt,what is the extension of this file if I
want to use it for saving this file. is it .bat file.

May be it is some silly questions which I am asking but truth is that I am
not really very good at writing scripts(batch) files. I REALLY WANT TO LEARN
MORE ABOUT RUNNING BATCH FILES,SCRIPTS FOR GIVING MORE CONTROL OF NETWORK
FOLDERS AND FILES,CAN YOU HELP ME TO FIND SOME GOOD WEB LINKS WHERE I CAN
FIND SOME GOOD SOURCE FILES FOR FOLDERS,AD,LDAP SCRIPTING.

Anyway thanks for all your responses.

mil.
 
millin said:
Hi,

Can I run it using a command prompt,what is the extension of this file if
I
want to use it for saving this file. is it .bat file.

Batch files are mostly saved with a .bat extension but a .cmd
extension will work too. You should run them from a Command
Prompt during the debugging phase so that you can see error
messages if they occur.
 
Back
Top