Search Results

Search found 3987 results on 160 pages for 'batch rename'.

Page 2/160 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Create a batch file to copy and rename file

    - by Estate Master
    I have little to no experience in writing batch files. I need to write one that copies a file to a new folder and renames it At the moment, my batch file consists of only this command: COPY ABC.PDF \\Documents As you can see, it only copies the file ABC.pdf to the network folder 'Documents'. However i need to change this so it renames the file ABCxxx.pdf, where xxx is a text variable that i would like to set somewhere in the batch file. For example, if xxx = "_Draft", then file would be renamed ABC_Draft.pdf after it is copied. Thanks

    Read the article

  • Rename multiple files in Unix

    - by john
    There are multiple files in a directory that begin with prefix fgh, for example: fghfilea fghfileb fghfilec I want to rename all of them to begin with prefix jkl. Is there a single command to do that instead of renaming each file individually?

    Read the article

  • Batch file to wait for other program to load/initialize, then execute command?

    - by Jason N
    I need some assistance writing what should be a fairly basic .BAT file. I load my main program, but that program takes ~20secs to load and be initialized. I have another command-line API I can execute to interact with this above program, but obviously until the above program is loaded and initialized there's no point in trying. If the program isn't running the command-line API returns a string stating exactly this - otherwise it just works and exits. Easy. So I want to wait until the above is loaded/initialized before firing my API command(s) at it. I could place a sleep/wait in there, but I want something more solid. The ~20sec wait is not necessarily consistent. Any way to execute the command-line API over and over until the response is satisfactory, then exit? J

    Read the article

  • Batch copy multiple folders and their subfolders to another folder

    - by DjLenny
    I have a folder X:\Export that has several folders X:\Export\Export1 X:\Export\Export2 X:\Export\Export3 etc. (names vary by a large factor) each Export folder has the same subdirectory structure but have different files. I would like to copy all the subfolders and the files of X:\Export\Export1 X:\Export\Export2 X:\Export\Export3 to a folder X:\Export\mergedExports keeping the subdirectory structure pseudocode of what I would like to do but cannot get working properly create new folder "merged" for (every folder X in a given directory Y) copy every file in X keeping directory structure to "merged" If conflict then overwrite

    Read the article

  • how to rename files with count

    - by nkint
    i have a directory like this: randomized_quad015.png randomized_quad030.png randomized_quad045.png randomized_quad060.png randomized_quad075.png randomized_quad090.png randomized_quad1005.png randomized_quad1020.png randomized_quad1035.png randomized_quad1050.png randomized_quad105.png randomized_quad1065.png randomized_quad1080.png randomized_quad1095.png randomized_quad1110.png randomized_quad1125.png randomized_quad1140.png and i want to rename the first files adding 0 in front of number, like: randomized_quad0015.png but i don't know how.. some help?

    Read the article

  • Need to extract thousands of folders and mass rename files inside folder corresponding to folder title

    - by user140393
    I did a site rip with wget and all the files I want are arranged with a webid which I do not want for example site.com/ID/title It appears as so in the directory siteIDFoldernameFile It's just a single file labelled index.html for the 10k+ ID's So essentially I want to remove ID folder while preserving the folder (file) inside. Then I want to rename the index.html inside of foldername to replace index.html

    Read the article

  • Could I centralize batch files more efficiently?

    - by PeanutsMonkey
    I am new to the world of batch scripting so please forgive what may appear as basic questions. I am learning as I get assigned different jobs and I am a huge proponent of automation where possible. I have several batch files that perform several tasks. Each of these files had their paths hard-coded e.g. c:\temp. d:\data, etc in the batch file. Initially I moved these to a text file I could call from a batch file e.g. for /f "tokens=1,2 delims==" %%R in (config.txt) do ( if %%R==bdata set bdata=%%S if %%R==cdata set cdata=%%S ) The config.txt file contains these values bdata=c:\temp cdata=d:\data I realized that each time I would need to create a new variable, I would need to update the config.txt file as well the config.bat files. I decided I would move all the values to just the config.bat file as follows set bdata=c:\temp set cdata=d:\data I then updated each of the existing batch files to call the variables rather than the hard-coded paths. I also added the following lines of code to each batch file except config.bat. The only additional line added to the config.bat file is @echo off. @echo off setlocal enableextensions enabledelayedexpansion call config.bat I then have another batch file that centralizes calling all the batch files in sequence. The name of this batch file is start.bat. The reason I am using start /wait is because there have been instances of where the delete.bat runs before compress.bat has had an opportunity to finish. start /wait compress.bat start /wait validate.bat start /wait delete.bat Questions Is this the best way to centralize values and if not, what is a better way? Do I need to specify setlocal enableextensions enabledelayedexpansion in all the existing batch files? Do all the batch files have to have @echo off or is it sufficient for just the config.bat file? Is start /wait the best way to call multiple files? Can I pass values from one batch file to another using the said command? All the batch files have different functions e.g. move, delete, etc however use %%a or %%b. Is this okay? For example The validate.bat file has the code for %%a in (%bdata%\*.*) do if "%%~xa" == "" move /Y "%bdata%\%%~xa" "%bdata%\%done%" and the delete.bat file has the code for %%a in (%bdata%\*.*) do if "%%~xa" == ".txt" del "%%a"

    Read the article

  • How to batch rename files copied from OSX to Windows with ':' in filenames?

    - by tputkonen
    This is really puzzling. I have lots of videos that were stored using Mac OS, and now I have to edit them on Windows XP. I copied files using HFSExplorer. Editing software refuses to open the files with their current names, and so far I have not found a way to batch rename all the files. Names of the files look like this: clip-2009-10-01 21;26;00.mov But I suspect in OSX the time was 21:26:00. I would like to replace the space with an underscore, and semicolons with dash. I've tried several bulk rename applications, with ; and :, but in vain. Also I've tried rename.pl, but also in vain.

    Read the article

  • rename files with the same name

    - by snorpey
    Hi. I use the following function to rename thumbnails. For example, if I upload a file called "image.png" to an upload folder, and this folder already has a file named "image.png" in it, the new file automatically gets renamed to "image-copy-1.png". If there also is a file called "image-copy-1.png" it gets renamed to "image-copy-2.png" and so on. The following function returns the new filename. At least that's what it is supposed to do... The renaming doesn't seeem to work correctly, though. Sometimes it produces strange results, like: 1.png 1-copy-1.png 1-copy-2.png 1-copy-2-copy-1.png 1-copy-2-copy-3.png I hope you understand my problem, despite my description being somewhat complex... Can you tell me what went wrong here? (bonus question: Is regular expressions the right tool for doing this kind of stuff?) <?php function renameDuplicates($path, $file) { $fileName = pathinfo($path . $file, PATHINFO_FILENAME); $fileExtension = "." . pathinfo($path . $file, PATHINFO_EXTENSION); if(file_exists($path . $file)) { $fileCopy = $fileName . "-copy-1"; if(file_exists($path . $fileCopy . $fileExtension)) { if ($contains = preg_match_all ("/.*?(copy)(-)(\\d+)/is", $fileCopy, $matches)) { $copyIndex = $matches[3][0]; $fileName = substr($fileCopy, 0, -(strlen("-copy-" . $copyIndex))) . "-copy-" . ($copyIndex + 1); } } else { $fileName .= "-copy-1"; } } $returnValue = $fileName . $fileExtension; return $returnValue; }?>

    Read the article

  • Iterating through folders and files in batch file?

    - by Will Marcouiller
    Here's my situation. A project has as objective to migrate some attachments to another system. These attachments will be located to a parent folder, let's say "Folder 0" (see this question's diagram for better understanding), and they will be zipped/compressed. I want my batch script to be called like so: BatchScript.bat "c:\temp\usd\Folder 0" I'm using 7za.exe as the command line extraction tool. 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. It is obligatory that the files extracted are in the same folder as their respective ZIP files. So, files contained in "File 1.zip" are needed in "Folder 1" and so forth. I have read about the FOR...DO command on Windows XP Professional Product Documentation - Using Batch Files. Here's my script: @ECHO OFF FOR /D %folder IN (%%rootFolderCmdLnParam) DO FOR %zippedFile IN (*.zip) DO 7za.exe e %zippedFile I guess that I would also need to change the actual directory before calling 7za.exe e %zippedFile for file extraction, but I can't figure out how in this batch file (through I know how in command line, and even if I know it is the same instruction "cd"). Anyone's help is gratefully appreciated.

    Read the article

  • Conditional Batch file renaming with mysql data

    - by Paul Stevens
    Hello, I wonder if anyone knows how could I rename multiple files, all of them originally named with same structure, and add some data extracted from a mysql DB according to specifics rules. For example I have 500 files named with this vars: ID NAME ADDRESS PHONE.wav = 1234567 PAULSIMON WESTDR122 9942213456.wav Now I need to rename files taking some data from the databases for each file, and append the data from a query appended to the filename. For example add the data resulting from a query Where some conditions match, and the data to build the query is taked from original file name, as ID or NAME. i other words, lets say that I want to build a query taking ID & NAME from file 1234567 PAULSIMON WESTDR123 9942213456.wav as WHERE statements to take another value as BirthDATE and add this to new filename, so final result should be: ID NAME ADDRESS PHONE BIRTHDATE.wav I will appreciate any help on this. I need this to be done on a LINUX server.

    Read the article

  • “Query cost (relative to the batch)” <> Query cost relative to batch

    - by Dave Ballantyne
    OK, so that is quite a contradictory title, but unfortunately it is true that a common misconception is that the query with the highest percentage relative to batch is the worst performing.  Simply put, it is a lie, or more accurately we dont understand what these figures mean. Consider the two below simple queries: SELECT * FROM Person.BusinessEntity JOIN Person.BusinessEntityAddress ON Person.BusinessEntity.BusinessEntityID = Person.BusinessEntityAddress.BusinessEntityID go SELECT * FROM Sales.SalesOrderDetail JOIN Sales.SalesOrderHeader ON Sales.SalesOrderDetail.SalesOrderID = Sales.SalesOrderHeader.SalesOrderID After executing these and looking at the plans, I see this : So, a 13% / 87% split ,  but 13% / 87% of WHAT ? CPU ? Duration ? Reads ? Writes ? or some magical weighted algorithm ?  In a Profiler trace of the two we can find the metrics we are interested in. CPU and duration are well out but what about reads (210 and 1935)? To save you doing the maths, though you are more than welcome to, that’s a 90.2% / 9.8% split.  Close, but no cigar. Lets try a different tact.  Looking at the execution plan the “Estimated Subtree cost” of query 1 is 0.29449 and query 2 its 1.96596.  Again to save you the maths that works out to 13.03% and 86.97%, round those and thats the figures we are after.  But, what is the worrying word there ? “Estimated”.  So these are not “actual”  execution costs,  but what’s the problem in comparing the estimated costs to derive a meaning of “Most Costly”.  Well, in the case of simple queries such as the above , probably not a lot.  In more complicated queries , a fair bit. By modifying the second query to also show the total number of lines on each order SELECT *,COUNT(*) OVER (PARTITION BY Sales.SalesOrderDetail.SalesOrderID) FROM Sales.SalesOrderDetail JOIN Sales.SalesOrderHeader ON Sales.SalesOrderDetail.SalesOrderID = Sales.SalesOrderHeader.SalesOrderID The split in percentages is now 6% / 94% and the profiler metrics are : Even more of a discrepancy. Estimates can be out with actuals for a whole host of reasons,  scalar UDF’s are a particular bug bear of mine and in-fact the cost of a udf call is entirely hidden inside the execution plan.  It always estimates to 0 (well, a very small number). Take for instance the following udf Create Function dbo.udfSumSalesForCustomer(@CustomerId integer) returns money as begin Declare @Sum money Select @Sum= SUM(SalesOrderHeader.TotalDue) from Sales.SalesOrderHeader where CustomerID = @CustomerId return @Sum end If we have two statements , one that fires the udf and another that doesn't: Select CustomerID from Sales.Customer order by CustomerID go Select CustomerID,dbo.udfSumSalesForCustomer(Customer.CustomerID) from Sales.Customer order by CustomerID The costs relative to batch is a 50/50 split, but the has to be an actual cost of firing the udf. Indeed profiler shows us : No where even remotely near 50/50!!!! Moving forward to window framing functionality in SQL Server 2012 the optimizer sees ROWS and RANGE ( see here for their functional differences) as the same ‘cost’ too SELECT SalesOrderDetailID,SalesOrderId, SUM(LineTotal) OVER(PARTITION BY salesorderid ORDER BY Salesorderdetailid RANGE unbounded preceding) from Sales.SalesOrderdetail go SELECT SalesOrderDetailID,SalesOrderId, SUM(LineTotal) OVER(PARTITION BY salesorderid ORDER BY Salesorderdetailid Rows unbounded preceding) from Sales.SalesOrderdetail By now it wont be a great display to show you the Profiler trace reads a *tiny* bit different. So moral of the story, Percentage relative to batch can give a rough ‘finger in the air’ measurement, but dont rely on it as fact.

    Read the article

  • SQL RENAME TABLE command

    - by Nano HE
    Hello. I can run RENAME TABLE student TO student_new ; The command is same and easy to follow. Is there a methods to rename a lot of tables in simple command. Assume all the tables belog to the same DB name. I don't need write a lot of code as below? RENAME TALBE pre_access TO pre_new_access; RENAME TALBE pre_activities TO pre_new_activities; RENAME TALBE pre_activityapplies TO pre_new_activityapplies; RENAME TALBE pre_adminactions TO pre_new_adminactions; RENAME TALBE pre_admincustom TO pre_new_admincustom; RENAME TALBE pre_admingroups TO pre_new_admingroups; RENAME TALBE pre_adminnotes TO pre_new_adminnotes; ... (there are still so many tables need to be renamed)

    Read the article

  • How can I set a time-limit on a batch file?

    - by drknexus
    I have a batch file that calls an external program that periodically hangs. What I would like to do is set a time limit on the batch file / CMD prompt such that it automatically closes after a certain period of time. One catch is that the external program that hangs may have one or more instances running at a given time, and I only want the batch file hitting its time limit to close the instance of the program triggered by the batch. How can I accomplish this? Ideally a solution would work on Windows XP, Vista, and 7.

    Read the article

  • How would I batch rename a lot of files using command-line?

    - by Whisperity
    I have a problem which I am unable to solve: I need to rename a great dump of files using patterns. I tried using this, but I always get an error. I have a folder, inside with a lot of files. Running ls -1 | wc -l, it returns that I have like 160000 files inside. The problem is, that I wish to move these files to a Windows system, but most of them have characters like : and ? in them, which makes the file unaccessible on said Windows-based systems. (As a "do not solve but deal with" method, I tried booting up a LiveCD on the Windows system and moving the files using the live OS. Under that Ubuntu, the files were readable and writable on the mounted NTFS partition, but when I booted back on Windows, it showed that the file is there but Windows was unable to access it in any fashion: rename, delete or open.) I tried running rename 's/\:/_' * inside the folder, but I got Argument list too long error. Some search revealed that it happens because I have so many files, and then I arrived here. The problem is that I don't know how to alter the command to suit my needs, as I always end up having various errors like Trying find -name '*:*' | xargs rename : _, it gives xargs: unmatched single quote; by default quotes are special to xargs unless you use the -0 option [\n] syntax error at (eval 1) line 1, near ":" [\n] xargs: rename: exited with status 255; aborting Adding the -0 after xargs turns the error message to xargs: argument line too long These files are archive files generated by various PHP scripts. The best solution would be having a chance to rename them before they are moved to Windows, but if there is no way to do it, we might have a way to rename the files while they are moved to Windows. I use samba and proftpd to move the files. Unfortunately, graphical software are out of the question as the server containing the files is what it is, a server, with only command-line interface.

    Read the article

  • How to debug MinGW32-make batch files?

    - by bryceman
    I'm having some difficulties building up some cross-platform Makefiles, and I'm getting errors from processes called by mingw32-make that don't make the problem clear. I've tried calling mingw32-make with "-d", and I get a lot of debug output, but the actual program invocations are hidden in temporary batch files that are immediately deleted. Is there any way to keep these batch files around, so that I can actually see what mingw32-make is doing under the hood, and fix what I assume is my problem?

    Read the article

  • How to code a batch file to copy and rename the most recently dated file?

    - by david.murtagh.keltie.com
    I'm trying to code a batch file to copy only the most recently dated file in a given folder to another directory on the local machine, and simultaneously rename it as it does. I've found a very similar question here http://stackoverflow.com/questions/97371/batch-script-to-copy-newest-file and have managed to cobble together the below code from other forums too, but have hit a brick wall as it only results in the batch file itself being copied to the destination folder. It doesn't matter to me where the batch file itself sits in order for this to run. The source folder is C:! BATCH and the destination folder is C:\DROP The code is below, apologies if this is a glaringly obvious answer but it's literally the first foray into coding batch files for me... Thanks! @echo off setLocal EnableDelayedExpansion pushd C:\! BATCH for /f "tokens=* delims= " %%G in ('dir/b/od') do (set newest=%%G) copy "!newest!" C:\DROP\ PAUSE

    Read the article

  • An Overview of Batch Processing in Java EE 7

    - by Janice J. Heiss
    Up on otn/java is a new article by Oracle senior software engineer Mahesh Kannan, titled “An Overview of Batch Processing in Java EE 7.0,” which explains the new batch processing capabilities provided by JSR 352 in Java EE 7. Kannan explains that “Batch processing is used in many industries for tasks ranging from payroll processing; statement generation; end-of-day jobs such as interest calculation and ETL (extract, load, and transform) in a data warehouse; and many more. Typically, batch processing is bulk-oriented, non-interactive, and long running—and might be data- or computation-intensive. Batch jobs can be run on schedule or initiated on demand. Also, since batch jobs are typically long-running jobs, check-pointing and restarting are common features found in batch jobs.” JSR 352 defines the programming model for batch applications plus a runtime to run and manage batch jobs. The article covers feature highlights, selected APIs, the structure of Job Scheduling Language, and explains some of the key functions of JSR 352 using a simple payroll processing application. The article also describes how developers can run batch applications using GlassFish Server Open Source Edition 4.0. Kannan summarizes the article as follows: “In this article, we saw how to write, package, and run simple batch applications that use chunk-style steps. We also saw how the checkpoint feature of the batch runtime allows for the easy restart of failed batch jobs. Yet, we have barely scratched the surface of JSR 352. With the full set of Java EE components and features at your disposal, including servlets, EJB beans, CDI beans, EJB automatic timers, and so on, feature-rich batch applications can be written fairly easily.” Check out the article here.

    Read the article

  • Escaping an equals sign in DOS batch string replacement command

    - by Alastair
    I need to replace some text in a JNLP file using a DOS batch file to tune it for the local machine. The problem is that the search pattern contains an equals sign which is messing up the string replacement in the batch file. I want to replace the line, <j2se version="1.5" initial-heap-size="100M" max-heap-size="100M"/> with specific settings for the initial and max heap sizes. For example at the moment I have, for /f "tokens=* delims=" %%a in (%filePath%agility.jnlp) do ( set str=%%a set str=!str:initial-heap-size="100M"=initial-heap-size="%min%M"! echo !str!>>%filePath%new.jnlp) but the = in the search pattern is being read as part of the replacement command. How do I escape the equals sign so it is processed as text?

    Read the article

  • Windows batch file to delete .svn files and folders

    - by Marco Demaio
    Hi,in order to delete all ".svn" files/folders/subfolders in "myfolder" I use this simple line in a batch file: FOR /R myfolder %%X IN (.svn) DO (RD /S /Q "%%X") This works, but if there are no ".svn" files/folders the batch file shows a warning saying: "The system cannot find the file specified." This warning is very noisy so I was wondering how to make it understand that if it doesn't find any ".svn" files/folders he must skip the RD command. Usually using wild cards would suffice, but in this case I don't know how to use them, because I don't want to delete files/folders with .svn extension, but I want to delete the files/folders named exactly ".svn", so if I do this: FOR /R myfolder %%X IN (*.svn) DO (RD /S /Q "%%X") it would NOT delete files/folders named extaclty ".svn" anymore. I tried also this: FOR /R myfolder %%X IN (.sv*) DO (RD /S /Q "%%X") but it doesn't work either, he deletes nothing. Thanks for any help!

    Read the article

  • Moving and renaming files, keeping extension but include sub directories in batch file

    - by Ser1esII
    Forgive me if this is nor the place to ask these questions, I am new to batch and scripts and a bit new to these kind of posts... I have a folder that will receive files and folders, I want to run a script that looks at the directory and renames all files in each subfolder numerically, and moves them if possible. For example I have something that looks like the following Recieved_File_Folder |_folder1 | |_file1.txt | |_file2.bmp |_folder2 | |_file4.exe | |_file5.bmp |__file9.txt |__file10.jpg I would like to be able to look in every directory and move it to something like this, keeping in mind the names of the files will be random and I want to keep the extension intact also. Renamed_Folder |_folder1 | |_1.txt | |_2.bmp |_folder2 | |_1.exe | |_2.bmp |__1.txt |__2.jpg I have spent alot of time on this and am not doing too well with it, any help would be very greatly appreciated!! Thank you in advance!

    Read the article

  • SQL SERVER – ColumnStore Index – Batch Mode vs Row Mode

    - by pinaldave
    What do you do when you are in a hurry and hear someone say things which you do not agree or is wrong? Well, let me tell you what I do or what I recently did. I was walking by and heard someone mentioning “Columnstore Index are really great as they are using Batch Mode which makes them seriously fast.” While I was passing by and I heard this statement my first reaction was I thought Columnstore Index can use both – Batch Mode and Row Mode. I stopped by even though I was in a hurry and asked the person if he meant that Columnstore indexes are seriously fast because they use Batch Mode all the time or Batch Mode is one of the reasons for Columnstore Index to be faster. He responded that Columnstore Indexes can run only in Batch Mode. However, I do not like to confront anybody without hearing their complete story. Honestly, I like to do information sharing and avoid confronting as much as possible. There are always ways to communicate the same positively. Well, this is what I did, I quickly pull up my earlier article on Columnstore Index and copied the script to SQL Server Management Studio. I created two versions of the script. 1) Very Large Table 2) Reasonably Small Table. I a query which uses columnstore index on both of the versions. I found very interesting result of the my tests. I saved my tests and sent it to the person who mentioned about that Columnstore Indexes are using Batch Mode only. He immediately acknowledged that indeed he was incorrect in saying that Columnstore Index uses only Batch Mode. What really caught my attention is that he also thanked me for sending him detail email instead of just having argument where he and I both were standing in the corridor and neither have no way to prove any theory. Here is the screenshots of the both the scenarios. 1) Columnstore Index using Batch Mode 2) Columnstore Index using Row Mode Here is the logic behind when Columnstore Index uses Batch Mode and when it uses Row Mode. A batch typically represents about 1000 rows of data. Batch mode processing also uses algorithms that are optimized for the multicore CPUs and increased memory throughput.  Batch mode processing spreads metadata access costs and overhead over all the rows in a batchBatch mode processing operates on compressed data when possible leading superior performance. Here is one last point – Columnstore Index can use Batch Mode or Row Mode but Batch Mode processing is only available in Columnstore Index. I hope this statement truly sums up the whole concept. Reference: Pinal Dave (http://blog.sqlauthority.com) Filed under: PostADay, SQL, SQL Authority, SQL Index, SQL Query, SQL Server, SQL Tips and Tricks, T SQL, Technology

    Read the article

  • A program/command to help translate multiple file names

    - by cipricus
    I have hundreds of files with different names that I want to translate into a different language. Is there an application/CLI action that would allow me to copy all this names as in a list/table and then, after having translated them, to paste them back into the list/table, or that would allow a procedure somewhat similar to "Rename" in Thunar but with a more complex action closer to what I have described? (I am in Lubuntu and I prefer not to use Nautilus due to unwanted interference with LXDE/pcmanfm desktop and LXPanel. If there is a solution in Nautilus please provide it but try to give an alternative if possible.)

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >