I am using the following cmd prompt to acquire a list of the files and folders in a directory: v:>dir/s>name.txt.
The text file seems to be too small for my directory (3700 items), as it omits items listed lower on the directory. I initially thought it was the size of the text file causing the problem because of the last comment in this thread:
Is there a size limit on a text file?
I tried changing the prompt to v:\dir/s>name.xls. This worked, but when I opened the excel sheet, the list still omitted files lower down in the directory. This is surprising because according to microsoft,
http://office.microsoft.com/en-ca/excel-help/excel-specifications-and-limits-HP005199291.aspx
an Excel sheet can be filled up to 65, 536 rows, and my newly sheet created only went to row 3561.
I could solve the problem by running the cmd prompt at the subfolder level, but I will have to run this command many, many times. If you have a solution, it would be much appreciated.
This will give you a list of all the files, hidden or system or not.
dir /b /s /a-d >file.txt
Related
My macro creates 1 identical txt files. One file is written to a shared network drive and the other file is written to a user personal drive. The file names are identical.
Each file should have a Total Line. Some files are created without a Total Line and this causes issues in downstream processing. If we could isolate that issue, then this question is irrelevant. However, we have not found the cause of the missing Total lines.
My solution was to check to check the shared network to see if the file exists. So far so good as that works.
Next I read the file (shared network drive) to see if the total line is found. That works as expected.
If the total line isn't found, I want to use this code to delete both files:
Kill vFileName
Kill vFileName2
vFileName and vFileName2 contain the path and file name including extension.
When the code runs, the first "kill" command is executed as expected.
When the 2nd "kill" command is executed, the macro exits the subroutine, without deleting the file, and continues running.
I added a On Error GoTo 0 to see what the error message is but there is no error message. I'm not sure what is going on. Any suggestions as to what is going on and why the 2nd file is not deleted would be appreciated. Thanks in advance for your help.......
Our programming archives contain tons of PLC programs (thousands of files)
Was recreating our backup structure, and wanted to filter through some of the junk. Made a batch file to delete all folders containing BAK with extension .acd, all files with .SEM, and .WRK, as these three are extra files that are created with opening the program, and are not needed. Some have gotten copied to the archives and duplicated many times.
I tested it on a copy of the folders, and wanted to run it routinely before the structure gets duplicated to other backup systems to prevent the backups from becoming cluttered again.
Here's the script I used:
del /q /s "Y:\Bays\*BAK*.acd"
del /q /s "Y:\Bays\*.Sem*"
del /q /s "Y:\Bays\*.Wrk*"
It deleted thousands of files, but as I watched I noticed three that did not make sense to me.
See the middle two deleted files:
"With Email" file:
These three were deleted, yet don't contain BAK in their names. I don't want to routinely run this if it will risk removing any copies of programs that aren't the automatically generated ones. Just hoping someone may be able to explain why these three were the only ones out of the thousands of deleted files to not follow the rule.
As you know, batch cannot delete files from directories with spaces between words. That's actually a bug that cannot be fixed, and wasn't built-in. So, I think that it's because of the unknown file extension, it happened the same to me. To make it known to your device, type regedit at the search bar, go to HKEY_CLASSES_ROOT, add a new key, and name it as the extension. Close regedit and try again.
Volume has property to enable generate short file names (8.3).
This property affects the execution of commands (del, for).
I have volume D where 8dot3 name creation is disabled
There is a file with name 1.abcd in folder.
Command for %i in (*.abc) do echo %i not find any files
I have volume C where 8dot3 name creation is enabled
There is a file with the same name 1.abcd in folder.
Command for %i in (*.abc) do echo %i find this file
Maybe if you use long file names then you need to disable generating short file names. You can do it with fsutil.
In no way do i think i'm an adequate unix administrator but i'm learning. I "cd" into a specific directory and it appears to be empty after i do a "ls". But when i "ll" it says this:
/integration/import$ ll
total 184
What is this total 184? And how do i see these text files. I've never seen anything like this before. super confusing.
My co-worker had originally said this: in the imports folder find the text file containing this order and move it out of the folder/queue.
The below should list the hidden files as well. Usually, hidden files are the one starting with a dot. e.g. .mail or so.
ls -latr /integration/import/
I get a report from the companies servers (of which I have no control) in the form of grep txt dumps. I need to process them to get the info in a sane manner, which I use excel, and it works great.
Problem is, sometimes there are a few txt files that are broken, and cannot be processed with excel. Funny thing is, if I open them in notepad or something, copy all the data, create a new txt file, paste it all and there and process the new file, it works perfectly. Another curious thing is that when I do this, the new file which works, is a few kb's larger than the "broken" original.
My question is, is there a program, script or macro that I could use to
Open the text files in a folder
Copy the text of a file
Paste it in a new text file
Save that file with the same name as the original, in a different
folder
Rinse and repeat for each file in a folder
Any idea is a great help, I have thousands of files to sift through each month, and it really is quite a pain.
Turns out the files were in Unix format rather than windows one. I ran todos.exe and it fixed my problems.
I am trying to edit the corflags file so that I can run 32bit applications on a 64 bit pc but everytime I try to edit the file using something like corflags.exe assembly /32bit+ it comes up with the error message cf001 could not open file for writing.
Now I have tried a lot of different options such as:
Running in administrator mode;
Finding the file using a search and checking read only is not ticked
Checking that user full control is ticked
Tried to set the whole folder to non read only
When trying the whole folder, it goes through looking like it has set read-only, but then I click OK and re-right click on the whole folder, the box is filled in (not ticked) does this mean that part of the folder is read only and why does it reset to read only?
I just faced the same problem and have tried the same things.
Run cornflags from an elevated ("Run as administrator") Visual Studio Command Prompt. I did the same for a copy of the original .exe just to make sure no other process was using the program.
Create a copy of the file you intend to target with CorFlags.
(e.g. "WcfServiceHost.exe" --creates--> "WcfServiceHost - Copy.exe")
Rename the original file to something else:
(e.g. "WcfServiceHost.exe" --> "WcfServiceHose_Original.exe")
Rename to copy to the original file name
(e.g. "WcfServiceHose - Copy.exe" --> "WcfServiceHost.exe"
For my purposes, I created copies and named them describing their configuration:
Example:
WCFServiceHost_With32BitOn.exe
WCFServiceHost_With32BitOff.exe
Now I can destroy the WCFServiceHost.exe files and create them from these pre-modified copies. No more CorFlags operations necessary.
Note: this is basically a more verbose version of #RMalke answer and that answer should be marked as the answer.
I realise this is years later, but for anyone else looking, I found that the quickest way was to copy cmd and corflags.exe into the same folder as the one you want to edit. Then run cmd as admin from there.