Results 1 to 5 of 5

Thread: copy data to multiple locations.

  1. #1
    Senior Member
    Join Date
    Jan 2004
    Location
    Leicestershire
    Posts
    1,212
    Thanks
    7
    Thanked
    31 times in 30 posts
    • madman045's system
      • Motherboard:
      • P9X79 Pro
      • CPU:
      • I7-3820
      • Memory:
      • 32GB
      • Storage:
      • Not enough!
      • Graphics card(s):
      • HD7970
      • PSU:
      • 850w Corsair
      • Case:
      • Corsair Carbide 300R
      • Operating System:
      • Win 7 Ultimate X64
      • Monitor(s):
      • Dell U2713HM & 2007WFP
      • Internet:
      • Plusnet FTTC - 30mbit/7mbit

    Question copy data to multiple locations.

    I need to copy two files from one folder, to 16 profile folders & then delete one file in another folder.

    Whats the easiest way to do this?

    Is it going to be a batch file with all the paths specified & would I be able to include the deleting part aswell?

    Thanks

  2. #2
    Comfortably Numb directhex's Avatar
    Join Date
    Jul 2003
    Location
    /dev/urandom
    Posts
    17,074
    Thanks
    228
    Thanked
    1,027 times in 678 posts
    • directhex's system
      • Motherboard:
      • Asus ROG Strix B550-I Gaming
      • CPU:
      • Ryzen 5900x
      • Memory:
      • 64GB G.Skill Trident Z RGB
      • Storage:
      • 2TB Seagate Firecuda 520
      • Graphics card(s):
      • EVGA GeForce RTX 3080 XC3 Ultra
      • PSU:
      • EVGA SuperNOVA 850W G3
      • Case:
      • NZXT H210i
      • Operating System:
      • Ubuntu 20.04, Windows 10
      • Monitor(s):
      • LG 34GN850
      • Internet:
      • FIOS
    Code:
    #!/bin/bash
    
    for i in name1 name2 name3 name4 name5 name6 name7 name8 name9 name10 name11 name12 name13 name14 name15 name16
    do
       cp /path/to/source/file /path/to/profiles/$i/rest/of/path/
       rm whatever
    done

  3. #3
    Senior Member
    Join Date
    Jan 2004
    Location
    Leicestershire
    Posts
    1,212
    Thanks
    7
    Thanked
    31 times in 30 posts
    • madman045's system
      • Motherboard:
      • P9X79 Pro
      • CPU:
      • I7-3820
      • Memory:
      • 32GB
      • Storage:
      • Not enough!
      • Graphics card(s):
      • HD7970
      • PSU:
      • 850w Corsair
      • Case:
      • Corsair Carbide 300R
      • Operating System:
      • Win 7 Ultimate X64
      • Monitor(s):
      • Dell U2713HM & 2007WFP
      • Internet:
      • Plusnet FTTC - 30mbit/7mbit
    thanks directx, confused lol!!

    its on a windows 2003 server.

  4. #4
    Ex-MSFT Paul Adams's Avatar
    Join Date
    Jul 2003
    Location
    %systemroot%
    Posts
    1,926
    Thanks
    29
    Thanked
    77 times in 59 posts
    • Paul Adams's system
      • Motherboard:
      • Asus Maximus VIII
      • CPU:
      • Intel Core i7-6700K
      • Memory:
      • 16GB
      • Storage:
      • 2x250GB SSD / 500GB SSD / 2TB HDD
      • Graphics card(s):
      • nVidia GeForce GTX1080
      • Operating System:
      • Windows 10 x64 Pro
      • Monitor(s):
      • Philips 40" 4K
      • Internet:
      • 500Mbps fiber
    A batch file might look something like this:
    Code:
    for %%i in ({space-delimited list of usernames}) do copy {path to source file 1} "c:\documents and settings\%%i\{destination path relative to user home folder}\"
    for %%i in ({space-delimited list of usernames}) do copy {path to source file 2} "c:\documents and settings\%%i\{destination path relative to user home folder}\"
    for %%i in ({space-delimited list of usernames}) do del "c:\documents and settings\%%i\{path to file to delete}\"
    Example where:
    - source files are C:\folder1\file1.lnk and C:\folder2\file2.lnk
    - usernames are Larry, Curly & Moe
    - destination for files is each users' desktop
    - files to delete are links on the users' desktops
    Code:
    for %%i in (Larry Curly Moe) do copy C:\folder1\file1.lnk "c:\documents and settings\%%i\desktop\"
    for %%i in (Larry Curly Moe) do copy C:\folder2\file2.lnk "c:\documents and settings\%%i\desktop\"
    for %%i in (Larry Curly Moe) do del "c:\documents and settings\%%i\desktop\old-link.lnk"
    An alternative could be to have a pair of batch files, the first has the for loop with the list of the 16 usernames and it calls the second (with "%%i" as the argument) which does all 3 tasks in one.
    This is really only a difference between depth-first and breadth-first iterative methods, for 16 users and only 3 commands keep it simple.

    (Don't forget quotes around path arguments if they contain spaces.)
    ~ I have CDO. It's like OCD except the letters are in alphabetical order, as they should be. ~
    PC: Win10 x64 | Asus Maximus VIII | Core i7-6700K | 16GB DDR3 | 2x250GB SSD | 500GB SSD | 2TB SATA-300 | GeForce GTX1080
    Camera: Canon 60D | Sigma 10-20/4.0-5.6 | Canon 100/2.8 | Tamron 18-270/3.5-6.3

  5. #5
    Senior Member
    Join Date
    Jan 2004
    Location
    Leicestershire
    Posts
    1,212
    Thanks
    7
    Thanked
    31 times in 30 posts
    • madman045's system
      • Motherboard:
      • P9X79 Pro
      • CPU:
      • I7-3820
      • Memory:
      • 32GB
      • Storage:
      • Not enough!
      • Graphics card(s):
      • HD7970
      • PSU:
      • 850w Corsair
      • Case:
      • Corsair Carbide 300R
      • Operating System:
      • Win 7 Ultimate X64
      • Monitor(s):
      • Dell U2713HM & 2007WFP
      • Internet:
      • Plusnet FTTC - 30mbit/7mbit
    Thank you Mr Adams!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Data Problem
    By xavxen in forum Help! Quick Relief From Tech Headaches
    Replies: 13
    Last Post: 08-09-2005, 03:12 PM
  2. Data Recovery
    By LayZeh in forum PC Hardware and Components
    Replies: 8
    Last Post: 04-08-2005, 11:00 PM
  3. Mac to PC data transfer
    By Vimeous in forum Apple Mac
    Replies: 1
    Last Post: 06-12-2004, 05:11 PM
  4. Replies: 4
    Last Post: 11-06-2004, 07:39 PM
  5. Replies: 10
    Last Post: 24-09-2003, 02:47 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •