Windows Batch Loop Through Files In A Directory

Start by selecting a bunch of files—you can hold down the Ctrl key to select multiple files at once, or Shift to select a range of files. The batch file will trigger that command whenever you run it. Batch files can be used to store a series of commands which can then used by the command line interpreter CMD as an input. In a second step the script removes folders that became empty after deleting the (old) files. I'm going to use a short batch process but to save time on the different ways of doing this, the example below uses a command prompt to a) create a batch file b) use it to rename the files c) delete the batch file. For example I have folders TEST1 and TEST2 inside root directory TEST. Since there is a no direct command to read text from a file into a variable, the 'for' loop needs to be used to serve this purpose. Get directory size. Folder Bomb Batch File: This is probably the most simple and productive batch "virus" there is. findstr /I windows * To search all the text files in the directory C:\data: findstr /I windows C:\data\*. It reads a file or a few files and then analyzes the contents of files. Batch file macros; Batch files and Powershell hybrids; Best Practices; Bugs in cmd. For renaming files, Batch Script provides the REN or RENAME command. Hi, I am new to Batch scripting. Threading; class Program { static void Main() { // Start notepad. When developing for Android platform, sometimes you find yourself typing the same commands in the adb (Android Debug Bridge), commands like granting permissions for internal files. Argument 1: The first argument to Directory. Batch Files As Administrator. A validation translation is run first, then the files that pass validation are translated to GML. Unlike other programming languages, in a batch file a variable is substituted by its actual value before the batch script is run. these looping variables. There is a clear presumption by the designers of R that you will be able to modify your input files using other tools, such as file editors or Perl 20 to fit in with the requirements of R. Updated PowerShell script to loop through files for printing. I need to create a windows batch script that accomplishes the following: checks the root of a specified directory and identifies the most recently modified or created file If the file wasn't modified or created within the past 24 hours (from when the batch file is running) then to execute another specified script. bat" and "voila" - you got perfectly resized images with a nice borders! I have tested it on Windows Server 2003, Vista and Windows 7 x64. Loops using while & for loop: Print nos. No need to use a batch file, the easiest way in XP is to do a search for all files and directories in your folder, choose the detail view and sort by date ascending. The TEXT_IO package has a datatype FILE_HANDLE. Here batch file is used to run specified script and invoke a DOS command just by double clicking on it. ECHO Start of Loop FOR /L %i IN (1,1,5) DO ( ECHO %i ) The 1,1,5 is decoded as: (start,step,end) Also note, if you are embedding this in a batch file, you will need to use the double percent sign (%%) to prefix your variables, otherwise the command interpreter will try to evaluate the variable %i prior to running the loop. Files in a Single Folder. Batch files are plain-text files. In this New folder make a Text file and type in "for /l %%n in (1,1,10) DO md %%n" and that is it. When using the command, make sure you are already in the directory where you want the files to be created. To do so, follow the steps below:. How to Re-Number the Files Sequentially on Windows using Batch Programming/Script? The first parameter is the prefix, and the second parameter the file suffix (extension). Limited though it may seem to some, other people perform magic using DOS' batch language without "extensions". Start by selecting a bunch of files—you can hold down the Ctrl key to select multiple files at once, or Shift to select a range of files. This is useful for many files. For /R, For /D, For /L Loop in Batch File Programming - Duration: How to Upgrade for Free to Windows 10 Home or Pro Call a function or other Batch file using Batch File Programming. exe crashing) are placed in a FAILED directory. Perl for loop. This tip is for Windows users, but the concept is the same for all platforms. How to Move Files with a Batch File. Usefull solution on how to create a batch loop to uninstall or delete a file in a users profile folder structure. File filtering. net file rename,rename file in vb. A number of switches or modifiers. All CCM versions. The latter may be done at the command line or from within a batch file. net but not C#. I need a batch script that will reference this list of file names and search through a folder and it's subfolders to find them. The problem is that some directories have >200 md5 files and I only want to verify the files created in the last 24 hrs. doc files with a ;. FOR /F - Loop through items in a text file. You may call that command we showed earlier from a batch file like this: If the batch file (e. You must set full path to "convert. FOR - Loop through a set of files in one folder. How can I run a batch file WITHOUT using cmd. How to batch rename multiple files on Windows. Reading of files in a batch script is done via using the FOR loop command to go through each line which is defined in the file that needs to be read. I need a batch script that will reference this list of file names and search through a folder and it's subfolders to find them. I need a batch file that will be set in a top level directory. How to use the Command Prompt in the Vista Windows Recovery Environment ; Rename a file or directory. bat" and "voila" - you got perfectly resized images with a nice borders! I have tested it on Windows Server 2003, Vista and Windows 7 x64. 13: Moving Files. sft files and do a count of them d) Present a grand total for each. Count number of lines in a file using DOS by Brett on February 25, 2007 Every once in a while I get on a computer and I need to count the number of lines in a file. Open windows explorer to the folder you want to apply this to. The password file simply adds an additional layer of security to our batch file. H ow do I run shell loop over set of files stored in a current directory or specified directory? You can use for loop easily over a set of shell file under bash or any other UNIX shell using wild card character. While there are sophisticated text editors you can use, Notepad will work. It the ECHO command is being CALLed for each line in order to resolve the variables. To auto-run a batch file as administrator, you need to first create the batch file, and then create a shortcut for it. Get directory size. Notice the commented lines in the file, these lines are not needed if the option to add the WinSCP's folder to %PATH% was selected during installation. I need a batch script that will reference this list of file names and search through a folder and it's subfolders to find them. Batch File Operators, If Else, Goto and For Loop We have learned about variables and how to create the variables in batch files and how to manipulate them to perform different computational tasks. In this guide, we'll show the process to rename one or a long list of files in bulk on Windows 10 using File Explorer, PowerShell, and Command Prompt. Folder Bomber This batch file will create 3000+ folder in less than a minute. Remember, nobody actually likes batch programming. Press any key to continue. Search for multiple strings. Re: Batch file For loop File in Directory « Reply #1 on: November 19, 2008, 10:16:21 AM » I've resolved this temporarily by passing the process sub-routine the names of all the paths using %~sf but would appreciate it if anyone had any better ideas. Unfortunately, I need to now exclude a specific subdirectory from the results (I don't want some of the jar files loaded). Now right click the PowerShellTest. Right click on the batch file and hit sent to>desktop to create a shortcut. Fortunately, In Windows 7 and above, you now have the option to rename multiple files (it’s called batch-renaming or renaming in batch). iso > Image 3. Type a few random letters into the file and save it as "C:\Temp\test. Introduction. bat, and run it from command prompt. Loop through each drive. Similar help and support threads Thread: Forum: batch&task to create new folder and move all desktop file to it hi so work in an recruitment office and im trying to create a batch file that the computers can run on a schedule to create a folder with that days date on it and move all files from the desktop to that folder( also created on the desktop), i want the code to only move files and. I have this batch: for /f %%a IN ('dir /b *. If the file exists, the batch file jumps to C_EXISTS and copies all the files from the current directory to the root directory on A:. There's no files to be copied just a folder or directory with nothing inside. GetFiles is the starting path. To access arguments beyond %9, you need to use the shift command. The tools come out of the box: the Windows command prompt and a text editor like Notepad. A batch file may contain any command the interpreter accepts interactively and use constructs that enable conditional branching and looping within the batch file, such as IF, FOR, and GOTO labels. How to Hide Files and Folders Using Batch Files. Although the batch file does not run from the root directory, the command will run if you enclose the command line within quotes. I had a heck of a time figuring out how to batch generate the test files. a) Look through a top level directory and obtain a list of folders (essentially this is the list being created for the foreach loop) b) Will then look at a particular sub directory in each folder c) Check for. Main audio tags are preserved in the process, as well as most file name characters (white spaces, question marks etc). Programs like 7zip File Manager will be able to access the folder. All CCM versions. The order of matches is dependent on the file system, and is totally unrelated to any characteristics of the filenames matched. To auto-run a batch file as administrator, you need to first create the batch file, and then create a shortcut for it. It can work just as a foreach loop works and it can act as a 3-part C-style for loop. If you want so then you have to open each sub folders and then take a screen shot. Batch file manually runs fine, does not using Task Schedulter By The Weekly Geek · 7 years ago We have a customer who uses a ticketing software developed elsewhere. Search All Files and Subfolders in a directory. I then need it to generate a. If any are missing then it reports those to a text file. This VBA macro will let you select a folder path and loop through each of the Excel files in the folder. In its simplest form, a batch file (or batch script) is a list of several commands that are executed when you double-click the file. exe is the default interpreter on all Windows NT-based operating systems, including Windows XP, Windows 7 and Windows 10. By checking potential conflicts and errors. The variable whose expansion should be delayed should be surrounded by exclamation marks instead of percent signs. To avoid confusion with the batch parameters %0 through %9, you can use any character for Variable except the numerals 0 through 9. a) Look through a top level directory and obtain a list of folders (essentially this is the list being created for the foreach loop) b) Will then look at a particular sub directory in each folder c) Check for. There are a few ways to do this:. Count sum of data (IE. You can create and modify batch scripts on just about any modern Windows machine. Next, drag in a For Each Loop. EXECUTING THE BATCH FILE. setMode "loop", single folder anything you select anywhere, using. There are several subfolders inside the backup folder named in the MM-DD-YYYY formats (i. I have a directory for which I want to list all the. Here is a Windows batch file that finds and deletes old files under a specific directory. I need to loop through the files on the network share directory and FTP those files to the Linux server so I can rename each one individually. Batch to delete file older than– Delete files older than 7 days using batch and script. Using the Directory and File Pathnames reader, read the Data folder containing all the MIF files. I found a clean solution that uses a batch file, and the scripting capabilities of FTP. cmd? Hidden features of Windows batch files. then to do another cut from the share to the local folder with the files required for the program to run. In batch files you can use these and create more of them. They are unique to the process running your batch file. If you need to search for multiple strings, then you can do that with the below batch script. I have a folder with 3 files in it that looks like this: ISO Images > Image 1. If you're renaming a bunch of files in the same folder and those files don't need completely different names from one another, Windows provides an easier way to rename those files in batch. Windows Command Prompt. @echo off for /F "tokens=4,5" %%a in ('dir c:\windows\fonts') do echo %%a %%b. In this case, we want to make a folder named TECHRECIPE, so we type in mkdir TECHRECIPE into CMD. Then using a for loop to iteract each folder, feeding them to Forfiles command with /p param, search for specify filename with /m param. I realise that it is … full filename and path but am unsure of the actual command prompt. Please help me on this regards. zip file, For example the script below creates a folder. dir /ad >c. Arguments handling in a batch file Tag(s): Misc Prog HowTo Each argument passed to BAT (or CMD) file is accessed with %1, %2, Or use %1 every time and when the processing of the current argument is done then use the command shift to switch the next argument into %1. cmd) featuring infinity loop for executing netstat command endlessly to capture established connection (can be stopped by CTRL+C to terminate. A macro file can contain up to eight tool macros and any number of non-tool macros. It is a Windows server isolated from external internet access and prohibited to install any new software. The command FOR searches recursive in directory D:\Test and all subdirectories for files matching the wildcard pattern *. So: First loop through the running processes. Bash offers several ways to repeat code — a process called looping. Often used in batch files to print text out to the user. hi, i want to create a batch file to disable changing system time and date hope some one will sure help me thank you: System Security: How to create a shortcut to batch file one folder up Hello I have been trying to create a shortcut to launch a batch file one folder up from the shortcut location. How to loop through files in a folder using MS DOS batch file or Commandline Posted on February 5, 2013 by Binary World — No Comments ↓ PowerShell rocks but I still use DOS commands to automate many day to day tasks. Enumerate files with extensions matching whitelist/blacklist. SVN checkout using BATCH and PowerShell F ew days back I was working on a script to automate project builds. bat for Windows that you can "drop" these TIF files on (or obviously specify them in a command line list when invoking the bat); upon which it creates a new folder with all my images process based on an EXE that I have. How to batch rename multiple files on Windows. Hi there I want to create a batch file which Get (mget) the newly added Files only from specific directory on UNIX server to specific folder on windows server using FTP, and this batch file will be scheduled on the windows server to run daily to load the new files (load the newly added files from the unix directory to the windows folder). Batch How To Mimic While Loops. Changed the example batch files slightly so that they first change the drive to the launched drive letter before changing into the launched directory. I need to loop through the files on the network share directory and FTP those files to the Linux server so I can rename each one individually. exe and the associated commands, and how to write Windows batch scripts for the interpreter. This method requires the use of a custom bat file function. (Hence the name, ECHO) Usually, this means directly to the screen, but the output of echo can be redirected, like any other command, to files or devices. IS this something that can be handled with powershell?. - open the Windows CMD command line, Mac OS X Terminal or Linux shell. So, files contained in "File 1. You could use that path info to run Java directly or to just set a PATH statement. I suggest that you create a special folder just for your own batch files and add this folder to your search path (as discussed in Chapter 11) so that you can run them from any folder in any Command Prompt window. Feature to run your scripts "Invisible" in the background without the batch file console. Open an url in Internet Explorer using batch file [Resolved] Posted by Patnaik. exe to wait (can easily be modified to use ping. For example, say you have a folder with 100s of jpeg files, and you want to rename them to. I hope this helps. The program scans the source folders for all files. Filename parsing in batch file and more idioms Tag(s): Misc Prog HowTo In the following examples, we iterate a list of files and use the idiom ~[idiom] to extract certain part of a given filename. I'm not going to pretend that I know much about DOS batch files other than fairly simply operations. You can use a combination of environmental variables and substring commands to do the rename right inline. Batch Script: to find files - posted in Programming: Hi, I have zero experience in batch scripting but I want to write a code that can accept a list of user input, that have partial filename, and. create a file called renamer. Launch the Task Scheduler by clicking Start, typing Task in the search box, and selecting Task Scheduler from the search results. A batch file is a Windows file with the. For example, this is a listing of a batch file named deploy. Rename file and append date or time stamp using batch script I found an even easier way to do this, but have left the original post below. log that I want to FTP to my server. cmd) My previous post on testing network drives led me to further research the topic, and I came to quite surprising (at least for me) results: the result if a check with IF EXIST depend on whether. I found a clean solution that uses a batch file, and the scripting capabilities of FTP. There is no direct while statement available in Batch Script but we can do an implementation of this loop very easily by using the if statement and labels. bat) is located in a directory whose path is included in your PATH environment variable, then you'll be able to run that batch file as a command prompt executable file from any directory. You want to run an application/command on selective files in a directory. The thing is, we Read more How To Create A Batch File in Windows 10. Choose output presets after file scanning. I'm trying to come up with a block to put in my batch file to loop through folders I'm copying to OneDrive to replace # and % with _. Programs like 7zip File Manager will be able to access the folder. You can follow the question or vote as helpful, but you cannot reply to this thread. I'm not going to pretend that I know much about DOS batch files other than fairly simply operations. @echo off for /F "tokens=4,5" %%a in ('dir c:\windows\fonts') do echo %%a %%b. I want to drag and drop a few files on a batch file and have it loop through and do something to each file. I am looking to see if i can have a file in folder A with 10 to 15 zip files. The tools come out of the box: the Windows command prompt and a text editor like Notepad. sft file (there will be many duplicates in all the directories) with th. Resetting NTFS files security and permission in Windows Resetting NTFS files security and permission in Windows” application data loop on the defualt folder. Unfortunately, I need to now exclude a specific subdirectory from the results (I don't want some of the jar files loaded). exe processor; Bypass arithmetic limitations in batch files; Changing Directories and Listing their Contents; Comments in Batch Files; Creating Files using Batch; Deprecated batch commands and their replacements; Differences between Batch (Windows) and Terminal. Hi Jose, this is almost perfect, although the the for /r seems to recurse the folder tree. Now that we are logged into our server, we can start executing our commands. So that first. Sql Scripts in a Folder When we need to execute multiple scripts against a server it's cumbersome to open each file in Management Studio and execute them individually. I have many pairs of files in a folder. Furthermore in this tutorial we will explain way to create batch to delete file automatically using command line. This helps in automating things and reducing the. So, this is all about the batch file for loops. csv) files in a given directory and just take out the name of CSV file 2) Use this csv file name and concatenate with some string. Search for multiple strings. You don't want to let them get to those personal files or folders. No need to use a batch file, the easiest way in XP is to do a search for all files and directories in your folder, choose the detail view and sort by date ascending. Programs like 7zip File Manager will be able to access the folder. works just fine for me, only important change to the code that i had to make was turning print into a function because im using python 3. This file will be used to demonstrate the VBScript code. This VBA macro will let you select a folder path and loop through each of the Excel files in the folder. I need to grab the folder name of a currently executing batch file. This is done through the. Initially i thought of wrtting. The benefit of storing batch files with some commands, is that you can schedule their execution so that, by the end of the day all commits done will be pushed to your remote repository, or that at the start of the day all your local repositories have fetched all the remote changes. A batch file can also be automatically executed when the terminal boots using the 'AutoRun. pdf') do call convert. In a blank workspace, add a Directory and File Pathnames reader, and set the dataset to the Directory (folder) containing all the MapInfo MIF files you wish to batch process, for this example it will be the Data folder. If you really need to protect your data then you should encrypt it. xml and pending. In Windows, scripts usually work with batch files. Unix-style shell utilities make it easy to do this sort of batch rename operation by finding and replacing patterns in filenames. I got a task in hand to remove all YAML. The variable whose expansion should be delayed should be surrounded by exclamation marks instead of percent signs. See the Batch File Basics and other Advanced Batch Files sections, if you need. You can get creative with the script by having the loop run another bat. GetFiles type. Put this macro in a file named "StartupMacros. FOR /F - Loop through the output of a command. Main audio tags are preserved in the process, as well as most file name characters (white spaces, question marks etc). I realise that it is … full filename and path but am unsure of the actual command prompt. How do you concatenate strings in a batch file? Concatenate Files Windows. I am not very strong in PS and i know some batch but have not been able to figure out how to accomplish this. If you don't have to write a big batch file, you shouldn't. So: First loop through the running processes. doc) DO echo %%i But now I want to put them all in a variable, add a ; in between and echo them all at once. Robocopy Syntax, Command Line Switches and Examples. I need a batch script that will Read each file in Directory 1 and checks, if same file exists in Directory 2, it should avoid duplicates files. At this point the rest is child's play: we can now use a For Each loop to loop through the collection of files and - if we choose - do something to each and every one. When you specify a certain file for Process. iso > Image 3. Copy and paste it in a plain text editor such as the Windows file%" echo Sound. /*; do something $(basename "$i"); done That would be the simplest way to iterate over the entries in a given directory (non-recursively). Using the following VBA to list files in a folder in a worksheet: 1. bat File? Discussion in 'Windows XP' started by the complete XP commandline refence is also available in the Windows Help program too. I hope this helps. FOR does not, by itself, set or clear the Errorlevel. The term "batch" is from batch processing , meaning "non-interactive execution", though a batch file may not process a batch of multiple data. Using Arrays in Batch Files. Seems like I have to maneuver to the program folder and run the vbs script. Using reST with Robot Framework allows you to mix richly formatted documents and test data in a concise text format that is easy to work with using simple text editors, diff tools, and source control systems. First off, let us see how to rename batch files without changing the extension. Similarly, if one tries to run a batch file from a directory that contains a. Macro files must have a ". 2010 I have a folder "C:\MyFolder" and I need to loop through the folder and get the names of all files in that folder. Batch file that replaces a filename in a txt file I've got a task that I need to repeat 100 times in a CAD program. The thing is, we Read more How To Create A Batch File in Windows 10. FOR /L - Loop through a range of numbers. I wanted a way to do this without using any extra software – just the default tools available in windows. I need a batch file that will be set in a top level directory. Automating the scripts with Windows Scheduler. You then select the files to be processed in the Windows Explorer and just drop them onto the script file. So here is the syntax or perhaps an example of for loop for looping through files in particular location. Re: Issuing List command to remote directory and output to file 2011-04-08 11:20 Would there be a possibility of this functionality being added in a future version as this would be very handy as an audit trail piece as well for confirmation that the files have reached their destination by attaching this file to an automated smtp email. FOR /F - Loop through the output of a command. Full Stop Bug. then to do another cut from the share to the local folder with the files required for the program to run. Also the save location has some files that the program requires to run. DOS Command Extensions - available on Windows 2000 and up - add a lot of automatic parsing and expansion that really simplifies reading filenames passed in as parameters. Reading of files in a batch script is done via using the FOR loop command to go through each line which is defined in the file that needs to be read. This is joined to the name of the directory in a cross-platform way with the file join command, which uses /, \, or : as the pathname separator on Unix, Windows, and Macintosh, respectively. We are using batch files because are easy to create, popular and can operate on several versions of Windows and DOS. What is a Batch (. I'm not going to pretend that I know much about DOS batch files other than fairly simply operations. Replace “” with the location of the folder that you want to use as a virtual drive. I need a batch script that will Read each file in Directory 1 and checks, if same file exists in Directory 2, it should avoid duplicates files. FOR does not, by itself, set or clear the Errorlevel. Replace text in a file using Batch script. found this off a google search. FOR - Loop through a set of files in one folder. or the same thing in a batch file, with the %'s doubled: for /f "tokens=*" %%G in ('dir /b /s /a:d "C:\Work\reports*"') do echo Found %%G. For example, if it renames files via FileMove or other means, each such file might be found twice: once as its old name and again as its new name. Many people think that the Command Prompt in Windows is DOS, but it’s actually a Windows 32-bit application (on 32-bit Windows) or a Windows 64-bit application (on 64-bit Windows) that provides a text mode (command line) interface to the system. I need to get the initial starting directory and save it in a variable. A file-loop can disrupt itself if it creates or renames files or folders within its own purview. # re: Windows CE: Running Batch Files There are always reasons for running a batch file in WinCE. I want to create a batch file that will loop through all the folders and will rename the files within it. The benefit of storing batch files with some commands, is that you can schedule their execution so that, by the end of the day all commits done will be pushed to your remote repository, or that at the start of the day all your local repositories have fetched all the remote changes. At this point the rest is child’s play: we can now use a For Each loop to loop through the collection of files and – if we choose – do something to each and every one. I am looking for some help writing a batch file to run on Windows Server 2008. cmd) My previous post on testing network drives led me to further research the topic, and I came to quite surprising (at least for me) results: the result if a check with IF EXIST depend on whether. FORFILES - Batch process multiple files. CMD’s directory will change to the chosen drive. Feature to run your scripts "Invisible" in the background without the batch file console. Batch to delete folder – Delete folder usin command line. Pass files through standard i/o filters as part of the transfer process. The thing is, we Read more How To Create A Batch File in Windows 10. Many people think that the Command Prompt in Windows is DOS, but it’s actually a Windows 32-bit application (on 32-bit Windows) or a Windows 64-bit application (on 64-bit Windows) that provides a text mode (command line) interface to the system. findstr /I windows * To search all the text files in the directory C:\data: findstr /I windows C:\data\*. DOS batch files (. doc) DO echo %%i But now I want to put them all in a variable, add a ; in between and echo them all at once. In this article you’re going to learn about the five main types of IF statements you can use in a Windows batch file, how the correct syntax looks, and a realistic example for each. Batch files can be used to store a series of commands which can then used by the command line interpreter CMD as an input. How to exclude files from a FOR loop in a batch file Posted on March 18, 2014 by Jerome The other day, my colleague ran into an interesting problem… he needed to process a bunch of files in a directory using a batch file, and one by one, archive them and send them somewhere by FTP. exm' file, depending on the device this file is located in the IPSM or the. › [Solved] Edit a line in a batch file from the same batch file › Problem with year in a batch file › Ampersand in a Batch file. I want to create a batch file that will loop through all the folders and will rename the files within it. Batch files Batch files provide a simple way to perform many repetitive or time-consuming tasks. During the month, the system date minus one day is executed by the batch file. txt will be a complete list of every file within the queried location. if i wanted to change those file's number into only 1,2,3,4,5,and so on. Old School with GOTO. I want to create a batch file that will loop through all the folders and will rename the files within it. What I want my batch script to do is to iterate through the "Folder 0"'s subfolders, and extract all of the containing ZIP files into their respective folder. 1 Fix #1: Delete cleanup. To save the command output to a file in a specific folder that doesn't yet exist, first, create the folder and then run the command. Freeware GUI Tools for copying Directory Structures. Search for multiple strings. FOR /F - Loop through the output of a command. findstr /I windows * To search all the text files in the directory C:\data: findstr /I windows C:\data\*. I can manage to change only the last file in the folder: Its an simple Batch Program on Windows. FOR - Loop commands. See the Batch File Basics and other Advanced Batch Files sections, if you need. sql) Choose how often to run the task; Choose the time to run the task; Enter the Windows User account credentials; APPLIES TO. FOR /D - Loop through several folders. Batch files can be used to automate simple tasks on Windows, such as installing software, setting up network connections or backing up files. Loops using while & for loop: Print nos. I need to loop through the files on the network share directory and FTP those files to the Linux server so I can rename each one individually. I am not to keen on Batch files, and have talked to several people trying to get walked through this, but I think it is a little bit beyond my capabilities. Count number of lines in a file using DOS by Brett on February 25, 2007 Every once in a while I get on a computer and I need to count the number of lines in a file. There's really just two methods of doing this.