w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
Copy/move all files which last modified date are in a given month
You can easily select files whose modification times are in a time range with the find command. Here's an example with gnu find, which makes this fairly simple: find . -newermt 'Apr 1, 2013 00:00' -not -newermt 'May 1, 2013 00:00' -exec mv -t /path/to/April_2013/directory '{}' '+' man find for all the gory details.

Categories : Bash

Batch script to delete files older than X days (based on creation date, not modified date)
See if this helps - Keep the 5 *.config files (skip=5) with the most recent creation date Test it on sample files. @echo off pushd "d:folder" del file2.tmp 2>nul for /f "delims=" %%a in ('dir *.config /b /a-d ') do call :getcreationdate "%%~fa" sort /r <file2.tmp >file.tmp for /f "skip=5 tokens=1,*" %%a in (file.tmp) do del "%%~b" del file.tmp file2.tmp popd pause goto :EOF :getcreationdate set "file=%~1" set "file=%file:=\%" WMIC DATAFILE WHERE name="%file%" get creationdate | find "." >file.tmp for /f %%b in (file.tmp) do set dt=%%b set dt=%dt:~0,8%_%dt:~8,6% del file.tmp >>file2.tmp echo %dt% "%~1"

Categories : Windows

batch command to copy a file when modified date is same as current date
i got the answer . "" will not be there and the braces will start from the same line of if like below : if %filedatetime:~0, 10% == %currentDate% (ROBOCOPY C:Documents and Settings302444Desktop C:Documents and Settings302444DesktopIMP\%date:~-4,4%%date:~-10,2%%date:~-7,2% inventory.txt ) and also the current date will set as currentdate=%date:~-10%. It is working. thanks for your time .

Categories : Windows

if modified date is same as current date then it will copy one file to a location
The starting (has to be on the same line as the if: if %filedatetime:~0,10% == %currentDate% pause ( ROBOCOPY C:UsersANIDesktopIMP C:downloads\%date:~-4,4%%date:~-10,2%%date:~-7,2%,RetailEmp.txt pause ) should look like: if %filedatetime:~0,10% == %currentDate% ( pause ROBOCOPY C:UsersANIDesktopIMP C:downloads\%date:~-4,4%%date:~-10,2%%date:~-7,2%,RetailEmp.txt pause )

Categories : Batch File

script to move folder based on modified date
You can use -exec along with find. Something like: find /mnt/STStorage/ -type d -mtime +14 -exec mv {} /mnt/LTStorage/ ; -type d will ensure only directories are moved. Another option is to use xargs find /mnt/STStorage/ -type d -mtime +14 | xargs -I '{}' mv {} /mnt/LTStorage/ Update: To add what is being moved, you can set the verbose mode option for mv find /mnt/STStorage/ -type d -mtime +14 -exec mv -v {} /mnt/LTStorage/ ; Since this will print everything on standard out. You can redirect it to a log file. find /mnt/STStorage/ -type d -mtime +14 -exec mv {} /mnt/LTStorage/ ; > /mnt/STStorage/log.file For emailing you can do something like - uuencode /mnt/STStorage/log.file /mnt/STStorage/log.file | mail -s "this is my subject line" chip@email.com

Categories : Bash

How to move all files from one directory to another whose Last modified date was less than today
you can do this by using the find command find . -newermt "2013-09-11 00:00:00" or in your case (for between) find . -newermt "2000-01-01 00:00:00" ! -newermt "2013-09-11 00:00:00"

Categories : Ubuntu

vbscript to get the files in a format from ftp with today's modified date
The general approach is described in this answer to a similar question. You just need to modify the filename pattern, e.g. like this: timestamp = Right("0" & Day(Now), 2) & Right("0" & Month(Now), 2) & Year(Now) .WriteLine "mget VarList12" & timestamp & "*.csv" .WriteLine "mget VarList10" & timestamp & "*.csv" .WriteLine "mget VarList11" & timestamp & "*.csv" .WriteLine "mget VarList22" & timestamp & "*.csv"

Categories : Batch File

Find files on windows modified after a given date using the command line
Don't think you will find it using dir. You can use PowerShell to do this, try: get-childitem -recurse | where-object {$_.lastwritetime -gt "12/07/2013"}

Categories : Windows

How to sort files by list elements by date modified, in Python?
from datetime import datetime strfmt = '%a, %d %b %Y %H:%M:%S +0000' res = sorted(files, key=lambda e: datetime.strptime(e['modified'], strfmt)) For the reverse, use the optional boolean reverse argument: rev = sorted(files, key=..., reverse=True) See sorted() for more information.

Categories : Python

Macro copy and paste based on date
Make Sure your checkboxes are not crossing to two different rows. Once you have ensured it, then I would do something like this: Assign same Macro to all the Checkboxes. In the macro, I will add the Following Code: Dim shp As Shape Dim rng As Range Dim currentRowNumber As Long Set shp = ActiveSheet.Shapes(Application.Caller) Set rng = shp.BottomRightCell currentRowNumber = rng.Row MsgBox "Currently, you are working on Row no " & currentRowNumber Once you have got the Row number, then you can easily find the values and write the code accordingly. Hope this helps! Thanks, V

Categories : Vba

Why does TortoiseSVN show the "modified" status icon for my working folder if there are modified, yet ignored files? Ignoring config file problems
You cannot ignore files that are already in the repository. Reread that first sentence. Ignoring something in a version control system says to ignore files that aren't already in the version control system. For example, Imagine you have a compilation process that took the *.c files that are in your repository and compiled them into *.o files. The *.o files are simply part of the compilation process, and you certainly don't want them accidentally added into your repository. If you ignore *.o files, and you did a svn status in Subversion, Subversion won't report on those files. If you did a svn add *, Subversion won't add those files to your repository. That's what ignore means in a version control system. If you modify a file, and you don't want to change it when you do a commit, you ha

Categories : Svn

XCode "Add Copy Files" build phase fails to copy header files when building universal framework
I found that one of the workaround is - just open and save all the files you included in the copy build phase and then build (Cmd+B). (just make the file dirty by adding a space so that modified date is updated)

Categories : IOS

how to write a windows batch script to copy some files and folders from location A to B based on a variable like server name
Use a text editor (for example the Windows built-in Notepad) to store the commands you would type on the commandline in a file. Save that file with the extension ".bat" or ".cmd". The command you'll probably want to use is "copy" or "xcopy". You can learn more about how to call them by calling them with "/?". Example: copy /? To learn more about environment variables, try: set /?

Categories : Windows

Copying the files based on modification date in linux
I guess I would first store the list of files temporarily and use a loop. find . -mtime -90 -ls >/tmp/copy.todo.txt You can read the list, if it is not too big, with for f in `cat /tmp/copy.todo.txt`; do echo $f; done Note: the quotes around cat... are backquotes, often in upper left corner of keyboard You can then replace the echo command with a copy command: for f in `cat /tmp/copy.todo.txt`; do cp $f /some/directory/ done

Categories : Linux

error during grouping files based on the date field
i suggest not to use split, but rather use String str = s.subtring(s.lastIndexOf(' ')); in any case, you try to take st[13] when i see you only have 9 columns. might be you just need st[8] one last thing, look at this post to learn what 06012010 really means

Categories : Java

Amazon S3, Syncing, Modified date vs. Uploaded Date
When listing objects in an S3 bucket, the API response received from S3 will always return them in alphabetical order. The S3 API does not allow you to filter or sort objects based on the LastModified value. Any such filtering or sorting is done exclusively in the client libraries that you use to connect to S3. http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketGET.html As for the accuracy of the LastModified value and it's possible use to sort the list of objects based on the time they were uploaded, to my knowledge, the LastModified value is set to the time the upload finishes (when the server returns a 200 OK response) and not the time the upload was started. This means that if you start upload A that's 100MB in size and a second later you start upload B that's only 1K in si

Categories : C#

Getting last modified date of a file not the last created date in Java
I got Creation date of a document using apache tika in java Here is my java code to get creation date of document: public class tikaExample { public static void main(String[] args) throws SAXException, TikaException { InputStream is = null; try { is = new BufferedInputStream(new FileInputStream(new File("/home/rahul/Downloads/darknet5.doc"))); Parser parser = new AutoDetectParser(); BodyContentHandler handler = new BodyContentHandler(); Metadata metadata = new Metadata(); parser.parse(is, handler, metadata, new ParseContext()); System.out.println("creation date "+metadata.get(Metadata.CREATION_DATE)); System.out.println("last modify date "+metadata.get(Metadata.LAST_MODIFIED));

Categories : Java

Copy the last modified Dir from one location to another using Perl
Use forward slashes. It just makes your code easier to read: $dir1 = "\\myserver1.name.com\builds\$ARGV[0]/$NewFolder"; vs. $dir1 = "//myserver1.name.com/builds/$ARGV[0]/$NewFolder"; Also, don't do system calls where Perl can do it. For example, Perl can see the last modification date of a file via the stat. Even better is the File::stat module that makes the stat command so much easier to use. Don't use @ARGV in your programs. Instead, read the variables from @ARGV into your own variables. It makes your program easier to understand, and your own variables have limited scope while @ARGV is global. Use modern conventions. Variable names should be in all lower case, and use underscores to separate out words. That is $new_folder vs. $NewFolder. Is this arbitrary? Yes, but it's a conve

Categories : Perl

Is there a way to commit part of modified files (all files are staged) by using libgit2sharp?
Is there a way to commit part of modified files (all files are staged) by using libgit2sharp? Currently, there's no way to perform a partial staging/unstaging in LibGit2Sharp. I'd suggest you to subscribe to Issue 195 in order to be notified when this is available. There are no Commit method in Repository that takes path parameter. Actually, the action of committing consists of taking a snapshot of the Index and creating a durable Commit git object in the object database. As such, the Commit API doesn't accept paths. In order to create a Commit from a file (or list of files) on your file system, you'd first have to add them to the Index with repo.Index.Stage(), then invoke the repo.Commit() method.

Categories : GIT

copy the recently modified file from source to destination in Batch script
for /f "delims=" %%i in ('dir /b /a-d /od "C:Source*.KNL"') do set "LatestModifiedFile=%%~i" echo copy "C:Source\%LatestModifiedFile%" "X:destinationpath" ..remove echo if it looks good.

Categories : Windows

Collection was modified; enumeration operation may not execute , even when i create a copy of the current object
You need to do a shallow copy, not a reference copy. Even though you copy it over, you only copy the reference, so you're enumerating over the same HashSet as the one you're deleting stuff from anyways. What you need to do is construct another enumerable, like a List<T>, over that. Like so: var vm2 = new List<YourType>(VM.Technology.TechnologyIPs); foreach(var ip in vm2) { tms.TechnologyIPs.Remove(ip); }

Categories : Linq

How to lock "last modified" date?
You can't "freeze" them, but you can record them, and then re-apply them using touch. That said: using a version control system as suggested by Marc is definitely the way to go.

Categories : Linux

How to get Created By and Last Modified Date using V2 Box iOS SDK
If you add the fields paramater and separate the items you want returned by comma, Box's response will return created_by and modifed_at. You can also retrieve modifed_by. http://developers.box.com/docs/#fields ?fields=created_by,modified_at

Categories : Iphone

How do I retrieve the modified date for the file?
Here is one way I figured out to get it (that actually works): client.getFilesManager().getFile(file.getId(), null).getModifiedAt() This, however, is somewhat slow, so I would greatly appreciate it if someone else knows a faster solution.

Categories : Java

Getting file last modified date (explorer value not cmd value)
It looks like this is ultimately an OS issue that you'd have to work around, like has been shown, especially since you've edited your code to account for DST. But you could also use the FileDateTime function. The help article for this points out that the result of this function is based on your system's locale settings. The help article for the DateLastModified property doesn't provide any such caveats, at least for Excel online help. To modify an exerpt from your edited code above: '1st row for path title, 2nd row for column headings loopCount = 3 For Each objFile In objFolder.Files Range("A" & loopCount).Value = objFile.Name 'use the full path name Range("B" & loopCount).Value = FileDateTime(objFile_fullpathname) Range("D" & loopCount).Value = objFile.Name

Categories : Excel

Display modified date outside the loop
You can do like this orderby posts with post_modified <?php $args = array( 'numberposts' => '5', 'orderby' => 'post_modified', 'post_status' => 'publish', 'category__not_in' => array(523) ); $recent_posts = get_posts( $args ); foreach( $recent_posts as $recent ){ echo '<li><b>'.$recent->post_modified.'</b> <a href="' .get_permalink($recent->ID) . '" title="'.esc_attr($recent->post_title).'" >' . $recent->post_title.'</a> </li> '; } ?>

Categories : PHP

When will a last-modified date indicate some time in the future?
It can't mention it, because it's completely up to the server how resources are implemented. As a primitive example, consider a server that serves a file system, and encounters a file with a timestamp from the future.

Categories : Http

How to use RecursiveDirectoryIterator with a Modified Date filter?
Ok you may try this example: class FilesystemDateFilter extends RecursiveFilterIterator { protected $earliest_date; public function __construct(RecursiveIterator $it, $earliest_date) { $this->earliest_date = $earliest_date; parent::__construct($it); } public function accept() { return ( ! $this->isFile() || $this->getMTime() >= $this->earliest_date ); } public function getChildren() { return new static ( $this->getInnerIterator ()->getChildren (), $this->earliest_date ); } } $directory = new RecursiveDirectoryIterator("c:\www"); $filter = new FilesystemDateFilter($directory, strtotime('2012-12-31')); foreach(new RecursiveIteratorIterator($filter) as $filename => $file) { echo $filename . PHP_EOL; } Not

Categories : PHP

How to sort file with modified date?
Either change your list to contain File objects or change your comparator to operate on String objects. I would recommend the former option. This allows you to establish the files exist before passing them into the comparator. Note that File.lastModified() returns 0 if the file does not exists (which might be unexpected). As mentioned in the comments, you can sort a list using Collections.sort() so you have no need to convert to an array.

Categories : Java

Get filename and file modified date to use for listview
Try using a Hasmap instead of ArrayList. public class MainActivity extends Activity { ArrayList<Contact> imageArry = new ArrayList<Contact>(); ContactImageAdapter adapter; File folder; int j = 0; Hashmap<String,String> FilesInFolder; //Filename:ModificationDate pairs @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); folder = new File(Environment.getExternalStorageDirectory() + "/tc/"); FilesInFolder = GetFilesData(folder.getAbsolutePath()); for (Map.Entry<String, String> current_file:FilesInFolder.entrySet()) { // imageArry.add(new Contact(R.drawable.ic_launcher, current_file.getKey(), curren

Categories : Java

Is max age relative to last-modified date or request time?
RFC 2616 section 14.9.3: When the max-age cache-control directive is present in a cached response, the response is stale if its current age is greater than the age value given (in seconds) at the time of a new request for that resource. The max-age directive on a response implies that the response is cacheable (i.e., "public") unless some other, more restrictive cache directive is also present. It is always based on the time of request, not the last modified date. You can confirm this behavior by testing on the major browsers.

Categories : Misc

Post Modified date in a formated way in WordPress
You can use PHP's strtotime() along with date(). It converts the given date into a timestamp and then back. Code: <?php $date = "2013-07-11 01:45:40"; $timestamp = strtotime($date); echo date('F d, Y', $timestamp); //output: July 11, 2013 ?>

Categories : PHP

FTP: Can I overwrite a file and maintain it's modified date?
You should be able to set the modified time with touch: http://php.net/manual/en/function.touch.php This requires PHP > 5.3 and the user running the script (probably your web user unless you run it from the cli) needs to have write permission on the file. You have two options for implementation: Store the filenames and their mtimes in temporary storage (either a file or a database table). When you finish the upload, run through all of the files and use touch to reset the mtime. As you upload the files, check to see if the file already exists. If it does, grab the mtime in a temporary variable, overwrite the file, then touch it with the correct mtime.

Categories : PHP

Append ddmmyy and update Date Modified
copying a file does not modify the "last modified" date. You need to touch the file. Read this SO Question Windows version of the Unix touch command and try copy %%a +,, copy %%a "import\%%~na_%All%.csv" Apart of that, I can give you a couple of suggestions for improvement.. you could just use the %DATE% environment variable instead of copying/parsing the output of DATE command. if the format of %DATE% does not fit your requirements, take a look at this SO answer http://stackoverflow.com/a/11183896/30447. you could use MOVE instead of COPY if you want to move the file (as you state in your Question). @echo off for %%a in (*.txt) do ( copy "%%a" +,, move "%%a" "import\%%~na_%DATE%.csv" )

Categories : Batch File

Sharepoint client GetFolderByServerRelativeUrl folder modified date
I don’t think there is any direct way to get the folder's modified data. But you can get the folder related item first, and then get the item’s modified data. But you still cannot get the folder related item using JavaScript Object Model. You can try to get the items which content type is folder by caml query, then fetch the item whose related file's server relative url is equal to the folder's server relative url, then you can get the detailed information from the item. var folder = rootweb.GetFolderByServerRelativeUrl("/Shared Documents/test2"); var query = new SP.CamlQuery(); query.set_folderServerRelativeUrl(“/Shared Documents”); var items = list.getItems(query); context.load(items, “Include(Title, FileSystemObjectType, File)”); context.executeQueryAsync(function(){

Categories : C#

git change branches with some files being modified
I know that I can safely change branches only if I don't have modified files in the tree, That's not really true; if the changes will apply cleanly, it will work fine. If not, you'll be told so and given the chance to fix them. Your second option is probably the safest: $ git stash $ git checkout br1 $ git stash apply $ git add ... $ git commit ... But it's quite likely that just: $ git checkout br1 $ git add ... $ git commit ... will work just fine.

Categories : GIT

Need to find files modified between 15 and 5 minutes ago
Using find, you can add additional conditions to create the range. Each condition is implied as "and" unless -o is used. You also want -mmin instead of -cmin for modified time (but they are often the same). find . '*PATTERN*.txt*' -maxdepth 0 -type f -mmin -15 -mmin +5

Categories : Bash

Undo modified files in git does not work
If git checkout and git reset --hard are leaving files in a modified state, it can be caused by git modifying line-endings or whitespace. Run git diff --ignore-space-change to see if there are non-whitespace changes. If the *.orig file is not tracked by git, but is ignored, you must add the -x parameter so that git doesn't use the standard ignore rules. git clean -f -x

Categories : GIT

How to get files modified by certain process in Linux
If the process is not already running, you can use strace to print system calls strace -o logfile <program> After this, write a script which will look for open() and write() system calls, and able to print the lists of files which are written too. If the process is already running, you will have to use the combination of several things lsof -p or /proc/<processid>/fd/* last modified time stamp of the files found in above output of strace -p <processid> to look for write() and open() Hope that helps

Categories : Linux

switching branch despite of modified files
It's not that Git refuses to allow a branch to change with uncommitted changes. It disallows changing a branch where changes would be overwritten. In your case I assume that the listed files have the same committed state between branches. If you want to see this kind of output duplicate your current branch, make some changes to some files and then switch to the other branch. git branch newBranch <edit some files> git checkout newBranch The checkout now shows exactly this kind of output.

Categories : GIT



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.