1.

Solve : Copy files from one location to another by removing the Date in file name?

Answer»

I need to Copy files from one location to another by removing the Date in file name. i will give the example for what i need exactly.

Location 1
C:\ from\file1_ddmmyyyy.csv
C:\ from\file2_ddmmyyyy.csv

Location 2
C:\to\ file1.csv
C:\ to\file2.csv

Location 3 (backup)
C:\ bkp\file1.csv
C:\bkp\file2.csv

i need a bat file to REMOVE the ddmmyyyy part from the file list and copy to the location 2 and 3 from location 1 as shown above... can u explain more? if i not mistaken u need something or SOFTWARE to enable u to edit file name including the data in it like date modify and such? true or not?

there are several way, if u just need to rename the file that have date in it like "someone120620112.jpeg" to "someone.jpeg", simply click on it once n then click it again once n see if the file name have became a box with all name in blue that mean select all or u can click on it and press f2 to enable u to change or rename it to other.

but if u said u want something to remove the inside info like time stamp or other, here a freeware to help u rename and change the info of it.

http://www.snapfiles.com/get/achanger.htmlI am ASKING for a bat file to do this task (here i am speaking abt more than 100 files)... doing right click and renaming the file is tat wat u knw ....?? i clearly mentioned wat i need ... Quote from: manis4486 on June 13, 2012, 01:04:27 AM

I need to Copy files from one location to another by removing the Date in file name. i will give the example for what i need exactly.

Location 1
C:\ from\file1_ddmmyyyy.csv
C:\ from\file2_ddmmyyyy.csv

Location 2
C:\to\ file1.csv
C:\ to\file2.csv

Location 3 (backup)
C:\ bkp\file1.csv
C:\bkp\file2.csv

i need a bat file to remove the ddmmyyyy part from the file list and copy to the location 2 and 3 from location 1 as shown above...
thanks in advance
Well you could do this two ways.
We could assume that your date is always the last 8 characters before the file extension and we could write a batch file to go off of that information.
We could also write a batch file based on the fact that you have an underscore before the date. So if that is the only underscore in the file name we could delimit the file name based on that commonality. Thanks for ur reply squashman .. can u give me some syntax or something ... so that i can build tat bat file... You need to tell me which example above is consistent with your data.if u give me a script with the second example.. i think i got a solution ...

then clearly i not read and understand ur post right. my appoligis on that. i want to tried to help. but since i'm bad in understand ur need. better stop trying now. but before i leave if u mean batch file renamer or such here a thing to do that. and please spare me if i'm wrong again this time.

http://www.freewarefiles.com/Ken-Rename_program_46337.html

this software can batch rename file. all u need to do is select the folder containing ur file n u can start the task by selecting method u want to use. it have delete word function that u can set from what to waht place u want to remove. it had preveiw that will showuthe end result before u finalize it. it easy to use.

once again pleae forgive me if i'm wrong this time. just trying to help.no i dont need any tool as i said ... i need a bat file ...Quote from: manis4486 on June 15, 2012, 05:46:57 AM
no i dont need any tool as i said ... i need a bat file ...

You can help yourself by making an attempt toward a solution and then posting it. We are excellent critics.

Code: [Select]@echo off
setlocal

set source=c:\from
set targetTo=c:\to
set targetBKP=c:\bkp

for /f "tokens=1-3 delims=_." %%i in ('dir /b %source%\*.csv') do (
copy "%source%\%%i_%%j.%%k" "%targetTo%\%%i.%%k"
copy "%source%\%%i_%%j.%%k" "%targetBKP%\%%i.%%k"
)

Methinks he just want's someone to write it for him...as opposed to learning.Quote from: patio on June 15, 2012, 06:30:44 PM
Methinks he just want's someone to write it for him...as opposed to learning.
That is a pretty common theme on most forums I belong to. On one forum I have seen this guy pretty much ask for help with about 2 dozen batch files over the past 6 months and has yet to help anyone with ANYTHING on the forum.@ sidewider .. thanks for your code ... its WORKING fine ...


Discussion

No Comment Found