Rename file migration using php

Source: Internet
Author: User
Using php to rename a file migration first shows that this is a sad story.

During the summer vacation, the school arranged for us to go to a software outsourcing company for an internship. it is very convenient to think about it without an interview. you can take this opportunity to learn from Daniel, although there is no salary (it is said that the school still pays 600 yuan of insurance), it is still expected to think about it, but the company will be forced to do so ~ No technicians are there, okay! Jobs have been arranged. what human resources, business management, financial management, and so on are trained, but no code is written!

I have been assigned to the business management department. every day, I contact various contract approvals, contract scanning, contract stamp, contracts... in short, it is far more complex than learning about contracts. I think it would be a bit hard for me to deal with repetitive and boring jobs without our company.

I have encountered such a problem. The company contract text must be scanned on the computer before being archived and uploaded to the company system. All scanned contracts exist in a folder.

"CDNs annual copy monthly copy Contract No."For example, the tenth contract name for the 15th year of July is" cd1507010.pdf ". There are about 300 contracts each month. To upload data to the system, you can upload the data to the system in one copy, or rename the data locally and send it to the system. Manual operations take more than an hour. Such repetitive and boring work is just a crash. For the first method, because I do not understand the system, I did not do more in-depth research, I focus on the second method. The local renaming rule isPlace the original PDF file under the folder "file name + C" and rename it htwb.pdf.

I want to solve the problem with my php language based on the principle that I should try to hand over my work to the computer. (I don't know if other languages are more efficient, but this is obviously more efficient than manual ).

The company's computer is configured as win7. although it is a software company, the computer level of non-R & D departments is no different from that of General companies. Taking into account the computer knowledge of the operator and the convenience of implementation, I did not install the Apache server or even start the IIS that comes with Windows, and directly usedCommand line.

The script named htzy. php is as follows:

 

Place the file in the folder to be processed, open the command line window in the folder, and enter

      php -f htzy.php

Wait a few seconds.

Simple use of mkdir () rename () function to complete file transfer, and finally use unlink to delete the script. therefore, to reuse this script, you need to save it ~

Now, the file migration is renamed.

Knowledge is power ~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.