Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Open more than 15 files at a time (about 200)


  • Please log in to reply
15 replies to this topic

#1 lunkerplunker

lunkerplunker

  • Members
  • 8 posts
  • OFFLINE
  •  
  • Local time:04:03 AM

Posted 14 November 2013 - 10:14 PM

Open more than 15 files at a time (about 200)

 

I posted this question at answers.microsoft.com and they did not answer me. I have posted there before with very good response but this is the first time I did not get a response. I hope it is ok to post this here

 

I have discovered that in the last two months I have files lurking on my HD that are corrupted. The only way I know to find the corrupted files is to open every file on my computer by file type. When I find a corrupted file I replace it from a backup. The problem is I have over 10,000 .mht files. 4000 .doc files, 1400 .pdf files, 1300 .txt files, etc.

 

If I can open 200 or 400 at a time I can go through all these files quite quickly and win8 pro allows all open files from one application to close instantly.

I would open a file window, put *.mht in a search and highlight 200 files and right click and open.

 

The problem is win8 pro only allows opening 15 files at a time.

 

Is there a way to open 200 or 400 files at a time and close instantly and go on the the next 2-400 in Windows 8 professional? I have a i7 haswell 15GB memory and 2GB video card, 2Tb HD, mid-tower case. That should be enough horse power to open 200 or 400 files at a time.

 

Thank you for the help


Edited by lunkerplunker, 14 November 2013 - 10:29 PM.


BC AdBot (Login to Remove)

 


#2 JohnnyJammer

JohnnyJammer

  • Members
  • 1,117 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:QLD Australia
  • Local time:08:03 PM

Posted 14 November 2013 - 10:57 PM

I quickl did this, i havnt etsted it but it would work. It will search a directory for eml files *.eml and dump that to a txt fiel and then iterate through that and open with Outlook. Just change the extention to match the programe.

@echo off
CLS
ECHO This will search for EML files and dump results into a txt file
ECHO It will then read the txt file and in this case use outlook to open each file
dir /b /on /s "C:\TEMP" | find /i ".eml" >> C:\EMLSearch.txt
FOR /F "tokens=*" %%a IN ('type "C:\EMLSearch.txt"') DO (
    "C:\Program Files (x86)\Microsoft Office\Office14\OUTLOOK.EXE" /eml %%a
    echo Opening %%a
    )



Edited by JohnnyJammer, 14 November 2013 - 11:17 PM.


#3 JohnnyJammer

JohnnyJammer

  • Members
  • 1,117 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:QLD Australia
  • Local time:08:03 PM

Posted 14 November 2013 - 11:14 PM

Actually you would be better to do this command by its self

dir /b /on /s "C:\TEMP" | find /i ".eml" >> C:\EMLSearch.txt

Then just see how there are in the txt file and reduce the number to maybe somethign a little less than 100 lines.

batch files can be handy



#4 lunkerplunker

lunkerplunker
  • Topic Starter

  • Members
  • 8 posts
  • OFFLINE
  •  
  • Local time:04:03 AM

Posted 18 November 2013 - 09:52 PM

Sorry I got back to you so late. Thank you for responding. When I ran everything the .txt file was blank so it did not work. I have to believe you are really close. Thank you for writing this code for me. I have to believe that some small detail would make this work. Thank you so much

#5 JohnnyJammer

JohnnyJammer

  • Members
  • 1,117 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:QLD Australia
  • Local time:08:03 PM

Posted 20 November 2013 - 05:15 PM

Ok did you change the directory to that of the the folder you want to search file extentions in? Also you would need to change the file textention from .eml to .docx or .pdf.

 

I only used C:\TEMP as a test folder, also this will work for UNC paths over networks shares as well, or just map a drive.

 

If you show me which file extention you ned searched and the folder path i could point you in the right direction, nd i will look to see if i can write somethign to check the CRC on the file maybe.



#6 lunkerplunker

lunkerplunker
  • Topic Starter

  • Members
  • 8 posts
  • OFFLINE
  •  
  • Local time:04:03 AM

Posted 20 November 2013 - 10:38 PM

Thank you for your help!!

 

It has been 25 to 30 years since I did MS DOS so your code is only vaguely familiar.

 

I did experiment with your code up to the limits of my memory of MS DOS. 

 

“Ok did you change the directory to that of the the folder you want to search file extentions in?” 

Yes .  I opened a command prompt with “run as Admin”.  Changed command prompt directory to user account. (C:\Users\Bob1)  Pasted your code.  Something about an “object” made it fail. 

I then used just the one line of your code:

dir /b /on /s "C:\TEMP" | find /i ".wps" >> C:\WPSSearch.txt

It just produced a blank WPSSearch.txt.

 

All the files I want to test are in the user account/directory. 

C:\Users\Bob1   need to search for corrupt files.  All the directories and sub-directories in it.

 

I do everything in a regular user account without Admin permissions.  I have to give admin permissions to command prompt, etc.

I am a little concerned about opening more the 200 files at once.

Perhaps a code to open 10 files at a time and close all files the open the next 10 and close all and so on till all the files can be tested.  If the code could do this automatically 10 at a time till all the files of .doc, etc., are done it would not take too long if all automatic.  I could just leave the computer to do the work. 

 

Below are the most important file extensions I need to search and test if corrupted.

All the directories and sub-directories in  C:\Users\Bob1

 

*.doc   I open with MS Word – 4020 .doc files

MS Word = C:\Program Files (x86)\Microsoft Office\Office14\WINWORD.EXE

 

*.mht  I open with Firefox – 10540 .mht files (Wow, yes over 10,000)

Firefox = C:\Program Files (x86)\Mozilla Firefox\firefox.exe

 

*.txt    I open with MS NotePad – 1359 .txt files

NotePad = C:\Windows\System32\notepad.exe

 

*.pdf   I open with Adobe Reader – 1479 .pdf files

Adobe Reader = C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe

          

*.jpg   I open with Firefox – 561 .jpg files

Firefox = C:\Program Files (x86)\Mozilla Firefox\firefox.exe

 

Thank You!!


Edited by lunkerplunker, 20 November 2013 - 10:56 PM.


#7 JohnnyJammer

JohnnyJammer

  • Members
  • 1,117 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:QLD Australia
  • Local time:08:03 PM

Posted 21 November 2013 - 12:18 AM

Ok so if you wanted to searchg for doc files then this would be it, just remember to run this first. I could make it better with Ruby as it would open the file silently using the WIN32OLE.new('Word.Application') but lets stay with this for now mate.

dir /b /on /s "C:\Users\Bob1" | find /i ".doc" >> C:\WPSSearch.txt

Now see how its using (dir /b /on /s "C:\Users\Bob1") that will will search for .doc files so you dont have to navigate through to C:\Users\Bob1 becasue the script does it for you.

Edit:: The (|) PIPE says ((anythign on the left echo into the right)) | find uses the find command in windows and the /i means dont make it case sensative.

So the script for doc files would look like this mate.

@echo off

CLS

ECHO This will search for Word Document files and dump results into a txt file

ECHO It will then read the txt file and in this case use outlook to open each file

dir /b /on /s "C:\Users\Bob1" | find /i ".doc" >> C:\WPSSearch.txt

FOR /F "tokens=*" %%a IN ('type "C:\WPSSearch.txt"') DO (

    "C:\Program Files\Microsoft Office\Office14\WINWORD.EXE" %%a

    echo Opening %%a

    )

 

Edited by JohnnyJammer, 21 November 2013 - 12:27 AM.


#8 lunkerplunker

lunkerplunker
  • Topic Starter

  • Members
  • 8 posts
  • OFFLINE
  •  
  • Local time:04:03 AM

Posted 21 November 2013 - 10:18 PM

Thank you so much for your explanation of the parts of your code.  I now know a little more when experimenting with your code.

 

I replaced .doc with .wps because I did not want to open 4000 .doc files at once.  I only have four .wps files on my computer.  I changed the path of winword.exe to work on my computer.

 

Here is the code I used:

@echo off

CLS

ECHO This will search for Word Document files and dump results into a txt file

ECHO It will then read the txt file and in this case use outlook to open each file

dir /b /on /s "C:\Users\Bob1" | find /i ".wps" >> C:\WPSSearch.txt

FOR /F "tokens=*" %%a IN ('type "C:\WPSSearch.txt"') DO (

    "C:\Program Files (x86)\Microsoft Office\Office14\WINWORD.EXE" %%a

    echo Opening %%a

    )

Below is the output:

ECHO This will search for Word Document files and dump results into a txt file

This will search for Word Document files and dump results into a txt file

ECHO It will then read the txt file and in this case use outlook to open each fi

le

It will then read the txt file and in this case use outlook to open each file

dir /b /on /s "C:\Users\Bob1" | find /i ".wps" >> C:\WPSSearch.txt

FOR /F "tokens=*" %%a IN ('type "C:\WPSSearch.txt"') DO (

%%a was unexpected at this time.

    "C:\Program Files (x86)\Microsoft Office\Office14\WINWORD.EXE" %%a

    echo Opening %%a

Opening %%a

    )

MS Word opened with an error that it could not locate “C:\Users\Bob1\%%a.doc”

I lived dangerously and ran the code to search for .doc files as you originaly had it.  I got the exact same outcome.  MS Word opened and could not find “%%a.doc”

 

The search part of the code worked!!  WPSSearch.txt contained the name and path of the four .wps files.  That is correct.

When I did it for the .doc files WPSSearch.txt contained the name and path for what appeared to be all the .doc files

 

That is all I can figure out for now.  Thank you so much!!


Edited by lunkerplunker, 21 November 2013 - 10:23 PM.


#9 JohnnyJammer

JohnnyJammer

  • Members
  • 1,117 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:QLD Australia
  • Local time:08:03 PM

Posted 21 November 2013 - 11:03 PM

mm ok ill look into it, i didnt test it as i dont even know if i have doc files on my home PC lol.

Anyway take this part out of the batch file

dir /b /on /s "C:\Users\Bob1" | find /i ".wps" >> C:\WPSSearch.txt

and just run it by its self, that way you can copy the text file and then just put like 20 lines of text in so it only opens 20 files.

 

Ill just create some dummy doc files and see why they arnt opening.



#10 JohnnyJammer

JohnnyJammer

  • Members
  • 1,117 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:QLD Australia
  • Local time:08:03 PM

Posted 21 November 2013 - 11:14 PM

ok i forgot to add "" around %%a

so for word its like this, remember to just run the directory search command first

dir /b /on /s "C:\Users\Bob1" | find /i ".doc" >> C:\WPSSearch.txt
@echo off
CLS
ECHO This will search for Word Document files and dump results into a txt file
ECHO It will then read the txt file and in this case use outlook to open each file
FOR /F "tokens=*" %%a IN ('type "C:\WPSSearch.txt"') DO (
    start "C:\Program Files (x86)\Microsoft Office\Office14\WINWORD.EXE" "%%a"
    echo Opening %%a
    )

Edited by JohnnyJammer, 21 November 2013 - 11:16 PM.


#11 lunkerplunker

lunkerplunker
  • Topic Starter

  • Members
  • 8 posts
  • OFFLINE
  •  
  • Local time:04:03 AM

Posted 23 November 2013 - 09:37 PM

I got the same results.  I did it for .wps files because I only have four.  Did it with Admin Command Prompt.

I first ran:

dir /b /on /s "C:\Users\Bob1" | find /i ".wps" >> C:\WPSSearch.txt

That worked correctly.  Created a .txt file with the four files and paths.

I next ran:

@echo off
CLS
FOR /F "tokens=*" %%a IN ('type "C:\WPSSearch.txt"') DO (
    start "C:\Program Files (x86)\Microsoft Office\Office14\WINWORD.EXE" "%%a"
    echo Opening %%a
    )

The results were:

FOR /F "tokens=*" %%a IN ('type "C:\WPSSearch.txt"') DO (
%%a was unexpected at this time.
    start "C:\Program Files (x86)\Microsoft Office\Office14\WINWORD.EXE" "%%a"
The system cannot find the file %%a.
    echo Opening %%a
Opening %%a
    )

As above results I got these error messages:

%%a was unexpected at this time.

and

The system cannot find the file %%a.

 

I thought I would try it for .txt files.  

I first ran:

dir /b /on /s "C:\Users\Bob1" | find /i ".txt" >> C:\TXTSearch.txt

That worked correctly.  

I next ran:

@echo off
CLS
FOR /F "tokens=*" %%a IN ('type "C:\TXTSearch.txt"') DO (
    start "C:\Windows\System32\notepad.exe" "%%a"
    echo Opening %%a
    )

I got the same results.

Everyone has .txt files on their computer.  Perhaps writing the code to search and open all the .txt files would be easier.  Then it would be easier to modify the code to work on other file types.

Thank you for your persistent help.
 


Edited by lunkerplunker, 23 November 2013 - 09:45 PM.


#12 JohnnyJammer

JohnnyJammer

  • Members
  • 1,117 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:QLD Australia
  • Local time:08:03 PM

Posted 24 November 2013 - 08:50 PM

Not sure why it wouldnt be wroking, it worked fine on my machine but i dont need the (86) in the office location, mine is (C:\Program Files\Microsoft Office\Office14\WINWORD.EXE)



#13 Platypus

Platypus

  • Moderator
  • 14,959 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Australia
  • Local time:08:03 PM

Posted 24 November 2013 - 09:38 PM

If there's an unknown proportion of files corrupted, is there a reason not to simply do a full restore from backup? e.g. unknown if backups are also corrupted, so confirming on an individual basis?

 

If the backup was known to be good (presumably it is since you're replacing corrupted files with good ones from the backup), surely it would be vastly less time consuming and difficult to simply restore all the backups?


Top 5 things that never get done:

1.


#14 lunkerplunker

lunkerplunker
  • Topic Starter

  • Members
  • 8 posts
  • OFFLINE
  •  
  • Local time:04:03 AM

Posted 25 November 2013 - 11:10 PM

JohnnyJammer

Thank you for your help. 

My Office 2010 installed in the 32 bit folder (C:\Program Files (x86)\Microsoft Office\Office14)

The 64 bit folder (C:\Program Files\Microsoft Office\Office14) has only 21 files in it.  Microsoft forums strongly recommends installing 32 bit version of Office 2010 which is the default installation.

 

Did your code work on your computer to search and open .txt files?

Thank you so much JohnnyJammer.  You realy worked a lot for me.

 

Platypus

thank you for your interest in this problem.  Your question made me do some investigating.  The answer I had for it is I made the assumption that all my backups had different corrupted files on different backups.  One file would be bad on one date and another would be bad on another date.  I have backups back to August 15, 2013.  I assumed bad files would be scattered through all these dated in between.

Your question really made me investigate my assumption of scattered date bad files.  I found a corrupted .mht file and a .doc file.  I tested both backup by backup to see when the corruption occurred.  I found that both files were corrupted 2013-09-13 and all backups later.  I found that both files worked on 2013-09-10 and earlier.  My assumption may still be true but this pattern suggests my assumption is incorrect. 

I right clicked the properties of my user account and said it was created 2013-09-13.  That was the evening I backed up my files.  Reinstalled windows 8 pro and reinstalled all the files backed up from earlier that evening.  I now see that there was something wrong with the 2013-09-13 backup. 

My backup method is to right click user account and copy to an external drive.  I cannot imagine what would go wrong with such a simple backup operation I have done successfully many times before.  This method creates the problem that every backup is a complete backup.  An differential/incremental backups would perhaps make this process easier. 

 

Another problem is I discovered the first corrupted file the week of November 4, 2013.  Later I discovered two more so then I knew I had a problem.  Since the assumed good backup of September 10, 2013 and up to today, I have saved and additional 400 or more files filed in many different places.  How do I replace the files of 2013-09-10 and preserve the newer files? 

I could search for all files after 2013-09-10 and save these somewhere else.  Then delete all the files in my user account.  Then restore all the files from 2013-09-10.  And then sort back into place the files after 2013-09-10.  I also have 5500 folders and I have moved these folders around since 2013-09-10.  A lot of work also.  I will have to think about it.  You question made me think differently about possible solutions.  If I keep thinking about it maybe I can come up with a solution that is less effort.

Thank you Platypus for your help.


Edited by lunkerplunker, 25 November 2013 - 11:15 PM.


#15 JohnnyJammer

JohnnyJammer

  • Members
  • 1,117 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:QLD Australia
  • Local time:08:03 PM

Posted 26 November 2013 - 07:13 PM

Yeh mate everything worked fine for me. Ive been pretty busy at work latley so havnt had much time to respond so when i get time i will try and write an app or script that will open and see if i can get it to check for errors.

backups are good but a restore point wont save your personal files only the system files, i implement Snapshots for my servers and home pc's so i can alsways restore witha  simple right click and search for previous versions, but your time line sounds a little out of scope for that.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users