Jump to content

simple file copying

Recommended Posts

Hi all, 

I wish to copy files from source to destination but the source and destination information has to be read from a file.

As an example, 

I wish to copy from

1. e:/dev/eb/fran/*.* to e:/prod/eb/fran/*.*

2. e:/dev/eb/inc/*.* to e:/prod/eb/inc/*.*

and so on.

More generally I would like a put the source and destination information in a file  as below 

1. e:/dev/eb/fran/A.html  e:/prod/eb/new_fran/A.html

2. e:/dev/eb/inc/B.php to e:/prod/eb/new_inc/B.php

and so on 

and then use it to copy the files.

Thanks !



Link to post
Share on other sites

Is this a one-time thing? I hope not. You're intending to write this file and then make changes over time? Add or remove things? How is this being used? Why is this being used?

Link to post
Share on other sites

Hi requinix !

Hope you are doing good. 

hmm, you got most of it correct

Well I have a a project in development whose copy i wish to create and remove all comments from it before uploading to the vps. The development site gets cluttered with so many additional files during development. The main files, added or deleted are only a few. So it becomes really cumbersome to separate the wheat from the chaff. I thought if I can have a list of files with path then i can simply maintain that list and use that to copy and paste from the dev to the other location.

Thanks !


Link to post
Share on other sites

Isn't that kinda just covering up the problem, though? If you have all these files you don't want, why do they exist at all?

Consider using Git. For multiple reasons, but two relevant reasons are:

1. You can see exactly what changes have been made since the last time, so I'd think it would be easier to delete what you don't want to keep.
2. If these files are being created for some reason that makes sense, you could have Git ignore those files so they stay on your machine.

Either way, you make the changes you want, commit and push, then go onto the live server and pull them down. It's a cheap and easy deployment strategy too - certainly better than copying files over FTP or something like that.

Link to post
Share on other sites

Hi Requinix, 

To begin with, I am using the GIT.

The new files are generated during testing and debugging.

I am using the linux to remove the comments from the files. The comments, besides the normal comments, can be a number of echos, exits, etc. scattered throughout my files across the project that i keep commenting on and off as needed. i want to remove all those and get my final files that I would use to set up on the VPS. Yes Maybe I can setup a git for these cleaned files as well and use that to install the project on the vps. 

Hence I need to find a way to copy and paste files from a maintained file.


Link to post
Share on other sites


I need to remove the commented out code as well as the comments ( probably less than the commented code) from the files and then use those on the live server. 


Link to post
Share on other sites

Why bother removing all the commented stuff before deploying?  If it's commented out then it wont run.

If you want some extra code to run locally for debugging then rather than constantly comment/uncomment the code make it conditional on something.  For example I setup an environment variable on my development systems called DEBUG_SERVER and can test for that in the code to enable extra stuff.

Finally if you really need to be doing some sort of processing before deploying, you could look into something like gulp.

Link to post
Share on other sites
This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.