I have modified some php code files which are part of a project that lives in a directory with subdirectories. Now I'd like to send a zip file which contains only the files that were modified last to another person. Like:
/c/index.php
/c/out/inc_out.php
/sales.php
Is there an easy way to select a date range and create a ZIP/RAR archive with the latest modified files? I'm on Windows.
Why using a script for this task? WinRAR supports such tasks directly.
Start WinRAR.
Navigate to the folder with the modified files to compress into a ZIP or RAR archive file.
Click on command Add.
Select the tab Time.
On list item Include files select either Newer than or Modified after.
Enter the appropriate time values according to the selected option.
Click on button OK.
WinRAR adds to the archive now only files with a last modification time according to the specified time values.
See help of WinRAR or file Rar.txt in program files folder of WinRAR if creating the ZIP/RAR archive file should be done from command line. There are explained the command line options -ta<date> (modified after) and -tn<time> (newer than).
Related
I was searching for this but i can't find anything like this.I'm new to PHP, I want to have a backup of all my pictures in specific directory.
I want when i click on link it collect all the images in that directory and compress them into a zip file, then it give me a download link for them.
I saw an answer before for how to (download multiple files as zip in PHP) but i don't know how to get all the images full names in this directory and merge them with the commands for zipping
I wish that's possible.
As we all know wordpress stores your uploaded files (for me,it's just JPG files) in a folder named "uploads" under "wp-content". Files are separated into folders based on year and month.
Now i want to copy every file from every folder into a single folder on another server (for some purposes). I want to know, does wordpress rename duplicate files? is it possible that my files be overwritten on the new server?
If yes, how can i avoid this? is there a way to make wordpress rename files before storing them?
You can scan your uploaded file folder and you have to options:
1.- Set a random name for each file
2.- Set a name convention including path and file name, for example: my_path_my_filename.jpg
By the way your file wont be overwritten cause is another server
This question seems about export/import...
Check exported XML (WordPress eXtended RSS file format), you can download all media URLs at <wp:attachment_url> tag... Use any XML parser.
Example without parser, at terminal:
cat exportedSite.xml | grep wp:attachment_url
will list all URLs. Each parsed URL can be downloaded by curl or wget.
If you whant to restore the XML backup, change (only) the URLs of the wp:attachment_url tags by the new repo URLs
I have lots of backup files in my FTP.
The file name like : index.php.bk-2013-12-27
I want to back up those files to the folder named /backup/
so inside of my httpdocs folder looks like this.
index.php
backup/index.php.bk.2013-12-27
the following both methods are fine to done this.
01. if any file contain name .bk that should be backed up automatically to the folder backup
or
02.
create a text file named backup_move.text that file contains the
paths of files that need to be copied and placed it into the httpdocs folder.
then the php script extract those file path from the
backup_move.text and sync the files to the folder named backup
How can I do this with some php coding.?
Any help will be very much appreciated.
It can be done (Both solutions).
But you need to tell if the solution (01) need to be recursive or Not. I suppose you know php has got a "time" to run (standard are 60 seconds), so you know that the file you need to backup cannot require more then 55 seconds to get a backup.
You can try and use the next link, it will backup completly a site, db and file and put it into a zip file. It need to be configured a little, but it can help.
http://www.starkinfotech.com/php-script-to-take-a-backup-of-your-site-and-database/
I have 16631 files hosted in a webserver, 2719 of them are text files that contains a list of specific files located on the server.
Using PHP, is possible to create a ZIP for each text file?
could be the text file name as ZIP file name?
I want to keep the same directory structure in the ZIP file.
Thanks in advance.
Taking the suggestion from Jeff Hines, you could use the ZipArchive class to create the zip.
In Pseudo code
Get List of Text Files in your folder
Read Text file and get list of files to add to zip
Using ZipArchive add each listed file to your new zip file.
Write flag to specify you've done this file.
You might need to run it on 10 files at a time since it may time out.
I have designed an online editor with which a user can create files and folders on the server. Suppose a user creates the below files and folders.
/docs/abc.txt
/docs/def.txt
/docs/work/assignment.txt
I want to write a PHP script to combine the files into a single ZIP file so that it makes it easier for the user to download them with one click.
The only purpose is that I should get a single file with the directory hierarchy maintained which the user can download and uncompress on his system to get the original files and directory structure back. I don't care even if the ZIP file is not compressed.
Note that I am using a shared server and do not have access to execute external commands.
ZipArchive class is what you need. Using this you can add directories and file to an archive.
This is a common requirement and has been solved. Try and check out this class: http://www.phpclasses.org/browse/package/2322.html
More tutorials at:
http://davidwalsh.name/create-zip-php <-- this has a similar example if you scroll down
http://www.w3schools.com/php/php_ref_zip.asp
Assuming you have permission to execute an external command, you could use exec to run an external command-line capable ZIP program such as 7-Zip.