Regarding ssis - move and rename files

Hi,
i have two txt files in c drive ,
and i have to move two files in d drive at a time and should rename that files

for some exmaples you can check this : http://www.rafael-salas.com/2007/03/ssis-file-system-task-move-and-rename.html
regards
joon

Similar Messages

  • Move and Rename file

    I am trying to move and rename all the files with extension csv in the folder. 
    c:\folder\a.csv c:\Newfolder\a20141151011.csv  datetime append after moving
    c:\folder\b.csv c:\Newfolder\b20141151011.csv 
    I cannot use ssis it has to be done in TSQL 
    DECLARE @FILELOCATION VARCHAR(250)
    DECLARE @FINALLOCATION VARCHAR(250)
    DECLARE @FILENAME VARCHAR (250) = '*.CSV'
    DECLARE @DESTINATIONFILENAME VARCHAR (250) --= @filename + '.txt'
    SET @FILELOCATION = 'C:\folder\'
    SET @FINALLOCATION = 'C:\Newfolder\' 
    DECLARE @C VARCHAR (2000)
    SET @C = 'MOVE ' + @FILELOCATION + @FILENAME  +' ' + @FINALLOCATION + @DESTINATIONFILENAME 
    exec master.dbo.xp_cmdshell @C

    the below code works fine for moving a file. For moving all files with their respective names you could try going in for a loop and achieving the same file by file.
    DECLARE @FILELOCATION VARCHAR(250)
    DECLARE @FINALLOCATION VARCHAR(250)
    DECLARE @FILENAME VARCHAR (250) = 'multilingual_sample.TXT'
    DECLARE @DESTINATIONFILENAME VARCHAR (250) = @filename --+ '.txt'
    SET @FILELOCATION = 'D:\'
    SET @FINALLOCATION = 'D:\Newfolder\'
    DECLARE @C VARCHAR (2000)
    SET @C = 'MOVE ' + @FILELOCATION + @FILENAME +' ' + @FINALLOCATION + @DESTINATIONFILENAME
    PRINT ISNULL(@C,'---')
    exec xp_cmdshell @c
    Thanks,
    Jay
    <If the post was helpful mark as 'Helpful' and if the post answered your query, mark as 'Answered'>

  • Is it possible to do this kind of Move and Rename?

    I save pictures a lot, and usually they clutter up on my Desktop until I organize them later into category folders. My folders are like this:
    VACATION PICTURES (Folder Name), and inside the pictures go: Vacation_1, Vacation_2, Vacation_3, etc.
    I'd like to be able to click on the cluttered pictures on my Desktop, then have a pop-up ASK me where I want to put the pictures (because I have a lot of folders, such as "Vacation Pictures," "Pet Pictures"), then ASK me what to rename them. Or, better yet, I want the script to automatically know what to rename the files based on what folder I select to move them to. For example, if I first direct the pictures to be moved to the "Vacation Pictures" folder, in which all the files are Vacation_1, Vacation_2, Vacation_3, etc., I want the program to automatically rename the newly-moved pictures and continue the existing sequence by going Vacation_54, Vacation_55, etc.
    So I want the script to automatically continue the already existing sequence in the folder. After the move, I want it to automatically figure out what the name will be and the sequence number to start on to join the others.
    Is this at all possible to do? If so, could someone explain how? Thank you so much!

    Hello
    You may try something like the code below.
    Save it as application, drag-drop the files onto it. It will ask you the destination folder and then do its tasks, hopefully.
    (It will create a temporary folder in destination for renaming file without name conflict and when done, move the temp folder to trash. It won't automatically delete the temp folder for safety. You may empty trash manually.)
    Script is partially tested under OS9.
    Hope this may help,
    H
    --SCRIPT
    on open aa
    main(aa)
    end open
    on main(xx)
    script o
    property aa : xx
    property tempname : "0.renamingbuffer" & (random number 10000)
    -- (0) accept destination
    set da to choose folder with prompt "Where do you put them?"
    display dialog "You're moving files to :" & return & return & da with icon 1
    -- (1) get last file name in destination (if there's no file, use destination folder name's 1st word)
    Finder of OSX 10.4 or later is required for proper 'numerical' sorting.
    E.g.
    'x_10.jpg' > 'x_9.jpg' by 'numerical' sorting, whereas
    'x_9.jpg' > 'x_10.jpg' by lexical sorting
    tell application "Finder"
    set ff to (sort (get files of item da as list) by name) as list
    if ff = {} then
    set n to (get item da's name)'s word 1
    else
    set n to ff's item -1's name
    end if
    end tell
    -- (2) make temporary folder for safe renaming
    tell application "Finder"
    set temp to (make new folder at da with properties {name:tempname}) as alias
    end tell
    -- (3) move and rename files
    1) move a file into temp (in destination)
    2) rename the file in temp
    3) move the renamed file in temp to the destination
    * this procedure will prevent any name conflicts.
    repeat with a in my aa
    set a to a's contents
    set n to nextName(n) -- get next name (w/o extension)
    tell application "Finder"
    set ext to a's name extension
    if ext is not "" then set ext to "." & ext
    set a1 to (move a to temp) as alias
    set a1's name to n & ext
    move a1 to da
    end tell
    end repeat
    -- (4) clean up & exit
    tell application "Finder" to delete temp
    display dialog "Done" with icon 1 giving up after 2
    end script
    tell o to run
    end main
    on nextName(n)
    string n : file name in form STEM_N.EXT, where N is integer. e.g., xyz_9.jpg
    return string : next file name w/o extension in form STEM_M, where M = N + 1. e.g., xyz_10
    set astid to a reference to AppleScript's text item delimiters
    set astid0 to astid's contents
    try
    set astid's contents to {"."}
    tell n's text items
    if (count) = 1 then
    set {m, x} to {n, ""}
    else
    set m to "" & items 1 thru -2
    set x to "." & item -1
    end if
    end tell
    set astid's contents to {"_"}
    tell m's text items
    if (count) = 1 then
    set k to 0
    else
    set m to "" & items 1 thru -2
    set k to item -1
    end if
    end tell
    set astid's contents to astid0
    --return m & "_" & 1 + k & x -- w/ extension
    return m & "_" & 1 + k -- w/o extension
    on error errs number errn
    set astid's contents to astid0
    error errs number errn
    end try
    end nextName
    --END OF SCRIPT

  • How to do this kind of Move and Rename? Please help.

    I save pictures a lot, and usually they clutter up on my Desktop until I organize them later into category folders. My folders are like this:
    VACATION PICTURES (Folder Name), and inside the pictures go: Vacation_1, Vacation_2, Vacation_3, etc.
    I'd like to be able to click on the cluttered pictures on my Desktop, select my Automator action (Move and Rename), and then have the Automator pop-up ASK me where I want to put the pictures (because I have a lot of folders, such as "Vacation Pictures," "Pet Pictures"), then ASK me what to rename them. Or, better yet, I want Automator (or maybe another program) to automatically know what to rename the files based on what folder I select to move them to. For example, if I first direct the pictures to be moved to the "Vacation Pictures" folder, in which all the files are Vacation_1, Vacation_2, Vacation_3, etc., I want the program to automatically rename the newly-moved pictures and continue the existing sequence by going Vacation_54, Vacation_55, etc.
    So I want Automator to automatically continue the already existing sequence in the folder. After the move, I want it to automatically figure out what the name will be and the sequence number to start on to join the others.
    Is this at all possible with Automator or any other program? Thank you so much!

    I think AppleScript would be easier than Automator to do this with, it's more flexible. In fact, I wouldn't be surprised if an AppleScript application could be made with Xcode (aka Applescript Studio) to do something like this. Either way, it could take some time before you could do anything if someone hasn't doesn't something like that already. Have you used the search feature in the AppleScript forums to find out if someone has some sort of image or picture or pic organizer? You might even try Google.
    However, what you've described sounds like it's verging on micromanaging, and it seems very time consuming. Have you consider the possibilities of iPhoto and maybe going along with something it can provide? For instance, is it really necessary to name each pic if they are already grouped? Personally, I'd rather tag them since then I only have to spell the tag once and then can easily find a variety of photos from several albums. For example, all the pics with flowers, or statues, or paintings, and what not. I hardly have any photos named in iPhoto and depend mostly on tags or the names of albums. It may not be worth renaming the old generic names with new generic names.
    Also, iPhoto is more specialized for managing images, while the Finder is generally for any type of file and therefore isn't very specialized for any particular type.
    Similarly, genres for music are useless to me and I'd rather tag songs with moods and subjects. So, I changed all the genre field into something more informative and that could be used for grouping the music into Smart Playlists by search criteria based on keywords in the genre field. Much more useful and worked like a great pre-Genuis option years before they added that.
    Anyways, just some suggestions for creating more flexible approach towards your hundreds of photos. It's helped me find what I want with both photos and music, in particular allowing me to create smart albums or playlists that automatically update themselves with new items whenever I tag another photo or song. No need to organize each and every single photo by dragging and dropping them into several relevant folders. They just show up where they fit in based on their tags, everywhere they belong. Though I have thousands of photos, I've gradually added tags to the older pics I had before tagging, and I definitely tag new ones as soon as I import them in iPhoto.
    Of course, you might have some fantastic plans needing this initial foundation you are suggesting. Personally, I cringe at the thought of ever doing what you are suggesting because I used to do things that way. And I never got done. Ever. With anything. And I figured out I really wanted something else. But that's me, and I just thought I'd throw these other ideas out there for you to reconsider your, uhm, adventure you have planned for yourself. :-D
    Good luck! I'm sure it can be done! And I hope it turns out to be useful for you! Go for it!

  • Open File dialog user can delete and rename files.

    Does any one know if there is a way to prevent a user from deleting and renaming files by right clicking on them in an Open File dialog box?

    Well, the problem is that this isn't a LV dialog box. It's the standard Windows file dialog box and this is the way they work in Windows.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Firefox will not show links to flv files. I get the error message for each flv file: "File not found. Firefox can't find the file at (path) .flv." Any mov and swf files in this same path will show. I can see the videos in Safari so the paths are correct.

    Firefox will not show links to flv files. I get the error message for each flv file: "File not found. Firefox can't find the file at http:// (path) .flv." Any mov and swf files in this same path will show. I can see the videos in Safari so the paths are correct.

    Is this a webpage that contains a link to a flv file? Please post a link to the page and tell us which link(s) are the problem flv files or else post a link to the .flv file itself.
    Alternately, click on one of the sample FLV File links on this page and tell us exactly what happens:
    http://www.mediacollege.com/adobe/flash/video/tutorial/example-flv.html
    It might also help if you post the exact error message, including the path to the flv file.
    '''Note:'''
    Depending on how you have Firefox set up, clicking on a FLV File link will either save the FLV file to your computer or Firefox may open it automatically in an external application right after downloading (Firefox may ask you first). Firefox itself can't play FLV files so you need a "helper" application (or a plugin for flv files, if ther is one. You can see if Firefox is already set up to download or open FLV files by going to Firefox Preferences and looking in the Applications list. Find the FLV file type in the list and, if the action is "Open with", it should show the application that can play FLV files (e.g., VLC Media Player or Perian). See [[Managing filetypes]] for more information.

  • How do I get my home movies and avi files to play on my ipad 3?

    How do I get my home movies and avi files to play on my ipad 3?

    1) Download a third party player on the iPad, such as avplayerhd or cinexplayer. Search app store for AVI and read some reviews.
    2) Convert the files in a program such as handbrake, mpegstreamclip on the pc and import them.
    3) Download air video from the app store, install the server software on the pc and stream away.
    Take your pick.

  • I need an iPad browser runs .mov and flash files

    I am looking for an iPad web browser that can run .mov and flash files.

    No Flash for iPads, iPhones, or iPods
    Here's why there's is no Flash available for iDevices or other mobile devices. Adobe was unable to provide a product that was suitable to the needs of battery powered mobile devices used for Internet browsing. Existing Flash technology used too much memory, ate battery life, and was buggy. Simply put Flash did not work well on mobile devices.
    Apple's Steve Jobs led the escape from Flash dependency when Apple introduced the iPhone, and later introduced the iPad. There was a hue and cry over the omission. Time proved Jobs was right on target.
    So this is why there is no Flash for your iPhone or iPad or iPod nor for most SmartPhones. Flash has been abandoned by many sites in favor of supported technologies such as HTML5 or by providing their own custom app.
    Here is Steve Jobs official comment on his momentous decision to omit Flash from iDevices: Steve Jobs on Flash.
    Here is Adobe's later announcement to cease development of Flash for mobile devices: Adobe on Mobile Flash. Adobe is not providing Flash for Apple iOS devices, and they no longer provide Flash for any other cellular phones. Flash is officially gone.
    Now, you are not necessarily out on a limb. There are some apps that can display some Flash, but don't count on there ability to display anything using Flash.
    A sample of Apps that can display some Flash content:
      1. Puffin
      2. SkyFire
      3. Photon Flash
      4. Browse2Go
      5. Swifter
    Also, note that many sites that use Flash provide their own app for accessing their material. So check with your favorite sites and find out if "there's an app for that."

  • Can Movie and TV files reside on different (external) HD?

    My entire iTunes library currently resides on my internal HD. I would like to keep all files, except movie and TV files, on my internal drive so I'll have them when I travel.
    I don't need the movie and TV files with me and would like to move them to an external drive. Is there a way to do this and have iTunes know where to look for them?
    Thanks for any suggestions....
    Lew

    David, welcome to discussions! You may find this link from MacMuse helpful on how to move iTunes to a different drive, either internal or external. I used this information to move my music to an EHD on my old PC where it worked just fine. One trick, you must always boot up the EHD prior to opening iTunes or iTunes will revert the location of the iTunes music folder back to the main drive & you will have a bunch of dead links to your song files. Post back if you have any questions.
    Oops, forgot the link!
    http://discussions.apple.com/thread.jspa?threadID=121879
    Message was edited by: StarDeb55

  • How do I batch convert 700 sequences to .mov and .mv4 files?

    I have 700 separate sequences in FCP. Each one is 20-30 seconds long. I need to rename them and convert them to .mov files and then also .m4v files?
    Is there an easy way to batch this or do I have to do them one by one by one by one..........

    Try using the *Export Queue* (in FCP click Window > Export Queue).
    1. Once the window is open, in the Browser window, highlight the sequences you wish to export.
    2. Click and drag them into the *Export Queue* window. You should see a folder called +Batch 1+, with all your sequences.
    3. Click on the +Batch 1+ folder and press the Settings... button at the bottom of the window.
    4. Set your output destination.
    5. To export full res, the format should be *QuickTime Movie*, and the settings should be *Item Settings*.
    6. Include *Audio and Video*, or *Video Only*, depending on what you need.
    7. Check the *Make Self-Contained* check box.
    If your sequences are NTSC DV, to export .m4v you will want to use Compressor 2, so that you can fix the aspect ratio (NTSC is 720x480 while the iPod size is 640x480 or 320x240. This is the difference between square and rectangular pixels.).
    1. In the *Compressor Preset* window, find the +iPod Video+ folder, and the +iPod Video+ preset inside the folder.
    2. Click the preset and press the *Duplicate Selected Setting* button at the top of the window. A setting called +iPod Video-Copy+ should appear in your Custom folder.
    3. Click on your new setting.
    4. In the Inspector window, use the 6 buttons to change the settings to what you need.
    5. Make sure in the Encoder section, that you choose your size (640 VGA or 320 QVGA) and pick the proper aspect ratio (4:3).
    6. Save your settings.
    7. Drag the full res files you exported from FCP into the Batch window. *Select All* (Command + A).
    8. Right-click in the Setting column and choose your +iPod Video-Copy+. It will apply that setting to all your videos (it may take a while depending on how many you do at once.)
    9. Save your batch.
    10. Submit!
    For renaming, you might try an Automator script. Search the forums or Google, if you need help with that!
    Hope this helps!
    -Tim

  • SSIS -Move multiple dynamic file

    Hi Experts,
    I am working on SSIS 2008
    I have a requirement where I need to move file from One folder to Other 
    i.e. from File_source folder to File_Destination folder
    I have Table in SQL Database , Table Name is File_name_tbl and column is File_Name.
    Table  contain few File Name of the files which are present in File_Source folder.
    Task is , Which ever file Name is present in File_Name_tbl , I need to move all this file from File_source folder to File_Destination folder.
    Every Day file Name in File_Name_tbl Changes ,  I need to run this task every day .
    I know I can use File System Task ,but how in this case  ,where File Name in Table matches with File Name in File_Source folder and move it .

    Implement the so called "Shredding a recordset" design pattern to get the file names from the table to operate on: http://www.sqlis.com/sqlis/post/Shredding-a-Recordset.aspx
    Parametrize the flat file connection manager connection string or destination package variable in a foreach loop that iterates over the records.
    Arthur My Blog

  • Unable to move or rename files on WebDAV shares

    I have not been able to get WebDAV shares to work properly on Lion.
    Let's say I have a "User" that has given ownership to a WebDAV folder named "Share". I can connect to my WebDAV share using Finder at "https://website.com/webdav" and I can successfully read files and folders in "Share". I can also delete and create files in "Share". But whenever I try to move or rename a file or folder I get a dialog with error code -43, complaining the "item required cannot be found". I got the same error on machines running both 10.6.8 and 10.7.2.
    I tried login with "User" with SSH and confirmed that I was indeed able to move/rename folder in the "Share" directory but just unable to do so using WebDAV. Any ideas? Thanks!

    @A
    Is it a normal behavior in the Web-DAV protocoll?
    @ctrld
    As I read you aliased the folder to a folder inside the user folder "/Users/username/Sync"?
    How can i realize it with a shared folder for uploading and downloading file with multiple users?

  • Can't move or rename files on outboard hard drive with bridge cs3

    I have a new computer operating with
    vista 64 bit os and an outboard drive with my pic
    tures.  Bridge says I don't have permission to move or rename the files but I can open the
    m and copy them.  I have to go into windows
    to physically delete or move files.

    It is a permissioning thing with Windows on external drives, that and speed, are reasons internals are much prefered.  I have found that if I right click on the Bridge start icon and chooose "run as administrator" it will work.
    I know this sounds strange on a single use machine where you have administrative rights, but just what I found that worked for me.

  • Applescript to extract subtitles, move and rename

    Hi guys. I'm trying to execute a script I've found on the web and adpated it a little bit.
    What I want to do is to extract .zip files from a folder, move the .srt files to the series/movies folder, and rename the .srt and .avi files to the same name.
    So far I was able to write the extraction and moving but after I changed some variables I got stuck with this script.
    Can someone help me?
    Below are the original e adapted scripts.
    ORIGINAL:
    property extensionList : {"mp4", "flv"}
    tell application "Finder"
        set the sourceFolder to choose folder with prompt "Select Input Folder"
        set the outputFolder to choose folder with prompt "Select Output Folder"
        set inputFiles to every file of the sourceFolder whose name extension is "rar"
        repeat with i from 1 to the count of inputFiles
            set theArchive to POSIX path of ((item i of inputFiles) as string)
            tell application "RAR Expander"
                expand theArchive to POSIX path of outputFolder
            end tell
        end repeat
        set extractedFiles to every file of the outputFolder
        repeat with i from 1 to the count of extractedFiles
            if (the name extension of the (item i of extractedFiles) is not in the extensionList) then
                do shell script "rm -rf " & quoted form of (POSIX path of ((item i of extractedFiles) as string))
            end if
        end repeat
    end tell
    ADAPTED:
    property extensionList : {"srt"}
    tell application "Finder"
              set the sourceFolder to (path to "/Users/*****/Downloads/Subtitles/")
              set the outputFolder to (path to "/Users/*****/Downloads/Series/")
              set inputFiles to every file of the sourceFolder whose name extension is "zip"
              repeat with i from 1 to the count of inputFiles
                        set theArchive to POSIX path of ((item i of inputFiles) as string)
                        tell application "The Unarchiver"
      unarchive theArchive to POSIX path of outputFolder
                                  tell application "The Unarchiver" to close
                        end tell
              end repeat
              set extractedFiles to every file of the outputFolder
              repeat with i from 1 to the count of extractedFiles
                        if (the name extension of the (item i of extractedFiles) is not in the extensionList) then
                                  do shell script "rm -rf " & quoted form of (POSIX path of ((item i of extractedFiles) as string))
                        end if
              end repeat
    end tell
    It's compiling but when I try to run it I get the error: It's not possible to transform "Users/*****/Downloads/Subtitles/" into constant.
    Thanks and sorry for my bad english.

    Ah, I didn't look farther on in the script.
    Generally it's bad practice to nest application tell blocks.  It usually works, but it's unpredictable and can produce some confusing errors.  Also, it's generally better to use System Events.app rather than the Finder (except for a couple of things the Finder does better).  SE is more efficient and less picky about file references.  so I've twiddled your script a bit:
    set dl to path to downloads folder from user domain
    tell application "System Events"
              set the sourceFolder to folder "Subtitles" of dl
              set the outputFolder to POSIX path of folder "Series" of dl
              set inputFiles to POSIX path of every file of the sourceFolder whose name extension is "zip"
    end tell
    repeat with thisArchive in inputFiles
              tell application "The Unarchiver"
                        unarchive thisArchive to outputFolder
                        close
              end tell
    end repeat

  • Automator script search document for file name, and rename file to date

    Hi all,
    I'm having a hard time with Automator... and I can't figure out how it's done!
    Searched the web for it a couple of times, spend hours with Automator already, but I guess my need is random!
    The thing is:
    I got a folder with 1066 files, all the files has random names.....
    I got a document (now it's html, but can convert it to PDF or txt or so ever....) with the coressponding random file names in the html.... some words before that there is the date the photo was taken in this format: 08/25/11
    Now I want somehow make automator search that folder each filename... match it in the document with the filename, and rename the files in the folder to the date the photo's were taken.... and that for all 1066 files.....
    anybody a great idea? Some help? I'm a real newby at Automator scrips!
    thanks

    Have you considered A Better Finder Rename 9?
    A Better Finder Rename 9: The Batch File Renamer for Mac OS X
    Otherwise, what you propose seems to be rather like carving the Pieta using a plastic butter knife. But, if you want, here's one example of a rough algorithm to start ...
    * translate the HTML to ASCII text in this format:  filename (date)
    * read one line at a time from the ASCII file
    * for each line, search the folder for the file
    * rename the file according to the (date)
    BTW, you might avoid a strict renaming according to just the date.
    Best luck with this project.
    JJW

Maybe you are looking for

  • Solution manager monitering activities

    Hi all, can anybody please help me out on solution manager daily,weekly and monthly activities. please............... thanx in advance. vinnu.

  • Images in Layout

    I'm trying to develop an applet, i'm working from some old books I bought a few years ago now, so i'm not even sure that the code i'm using is still current, tbh my applet isn't showing right now (not with Mozilla on Fedora 3, but does on XP with Moz

  • Purchase requisition valuation

    I got a problem when a Purchase Requisition has been created regarding the Valuation that is R 1.00 even after an INFO Record has been selected or a Contract item has been selected. 1)         Firstly when an item is been put on a requisition and the

  • Inforecord standart report with valid on

    hi all, I am looking for a report which displays the "Valid on" data of Info-record. I tried the ME1M transaction but the information is not displayed. Thanks Pierre

  • HT3176 my apple remote will not link to my appletv even after changing the battery

    my apple remote will not link to my appletv even after changing the battery.  can anyone help?