I'm trying to execute a "diff" command in P4's command line tool on a subset of files.
I would like to diff files in a certain directory that correspond to a certain extension.
Is there any way to specify an extension with the "diff" command ?
From what I gather from the documentation, such a thing is not possible.
How would you do "diff" only for files with a certain extension ?
Thanks !
Not sure if diff in particular allows for multiple files, but in general, P4 allows for wildcards via ..., so for all txt files in a certain subdirectory, you could say
//depot/stuff/whatever/....txt
That will filter out all .txt files in this particular path.
Related
I need to store data in a file in this format
word, audio, jpeg
How would I store that all in one file? Is it even possible do would I need to store links to other data files in place of the audio and jpeg. Would I need a custom file format?
1. Your own filetype
As mentioned by #Ken White you would need to be creating your own custom file format for this sort of thing, which would then mean creating your own parser type. This could be achieved in almost any language you wanted but since you are planning on using word format, then maybe C# would be best for you. However, this technique could be quite complicated and take a relatively large amount of time to thoroughly test your file compresser / decompressor, but may be best depending on your needs.
2. Command line utilities
Another way to go about this would be to use a bash script to combine all of the files into one file, and then decompress it at the other end. For example the steps could involve:
Combine files using windows copy / linux cat command on command line
Create a metdata file of your own that says how many files are in this custom file, and how much memory each one takes up (could be a short XML or JSON file for example...)
Use the linux split command or install a Windows command line file splitter program (here's just one example) to split the file back into whatever components have made it up.
This way you only have to create a really small file type, and let the OS utilities handle the combining of them for you.
Example on Windows:
Copy all of the files in your current directory into one output file called 'file.custom'
copy /b * file.custom
Generate custom file format describing metadata (i.e. get the file size on disk in C# example here). This is just maybe what I would do in JSON. SO formatting was being annoying so here's a link (Copy paste it into an editor or online JSON viewer).
Use a decompress windows / linux command line tool to decompress each files to the exact length (and export it back to the exact name) specified in the JSON (metadata) file. (More info on splitting files on this post).
3. ZIP files
You could always store all of the files in a compressed zip file, and then just use a zip compressor, expander as and when you like to retreive any number of file formats stored within.
I found a couple of examples of :
Combining multiple files into one ZIP file in only C# .net,
Unzipping ZIP files in C#
Zipping & Unzipping with only windows built-in utilities
Zipping & Unzipping in Linux command line
Good Zipping/Unzipping library in Java
Zipping/Unzipping in Python
I have a question regarding multiple File extensions. There are two files which I need to check whether it exists or not
File Names
Data.success
Data.failure
It works fine when I load one file b
success.file=Data.success
However, when I try to load multiple file extensions it doesn't file
success.file=Data.success|Data.failure
Code
{{FilePath}}?fileName={{success.file}}&&consumer.bridgeErrorHandler=true
Use the include option instead which is a regular expression, there you can set a pattern to match your files
And then do not use the fileName option.
See more in the Camel documentation: http://camel.apache.org/file2 about these options and how they work.
I want to exclude some directories from an archive using the PASE tar command on an IBMi but the [-X Exclude File] option doesn't seems to work for me.
I tried using an exclude file that just contained a file name (/home/JSMITH/data/sub2/file2.txt) and then one that just contained a pattern (*.txt), and neither archive operation omitted anything.
Given the following directory structure:
/home/JSMITH/data
/home/JSMITH/data/sub1
/home/JSMITH/data/sub1/file1.txt
/home/JSMITH/data/sub2
/home/JSMITH/data/sub2/file2.txt
/home/JSMITH/data/sub3
/home/JSMITH/data/sub3/file3.txt
and the following command:
/qopensys/usr/bin/tar -cvf /home/JSMITH/test.tar -X /home/JSMITH/excludes.txt /home/JSMITH/data
The entire /home/JSMITH/data structure gets included in the resulting archive.
I have tried using the /home/JSMITH/excludes.txt file with either of these contents:
/home/JSMITH/data/sub2/file2.txt
or
*.txt
How does one exclude files/directories/patterns from the IBMi PASE tar command?
You need the full path in the exclude file.
I created mine via ls /home/JSMITH/data/*.txt > /home/JSMITH/excludes.txt
If you're doing it by hand, make certain you haven't got any trailing whitespace.
Also, I used Notepad++ when I created mine by hand. I found that the green screen edtf created an EBCDIC file with CRLF in it, and that didn't exclude for me.
IBM i 7.1
I have a problem when trying to upload multiple files to one WinSCP directory, i can manage to copy just one single file, but the problem is that i need to upload many files that are generated by a software, the names are not fixed ones, so i need to make use of wildcards in roder to copy all of them, i have tried many variants on the code, but it all was unsuccessful, the code i am using is:
open "sftp://myserver:MyPass#sfts.us.myserver.com" -hostkey="hostkey"
put "C:\from*.*" "/Myserverfolder/Subfolder/"
exit
This code does actually copy the first alphabetically named file, but it ignores the rest of the files.
Any help with it would be much appreciated
Try this in script
Lcd C:\from
Cd Myserverfolder/Subfolder
Put *
Try and do all manually first so you can see what's going on.
I'm recently new to batch scripting. I need to rename a few thousand files, each one having a different file extension to a single common extension. The files come off a machine like so:
1.2.840.113619.2.131.3171610912.1353091118.893703
which windows tells me is a type "893703" file because of the fullstop(.) position.
So I need to turn this example:
1.2.840.113619.2.131.3171610912.1353091118.893703
1.2.840.113619.2.131.3171610912.1353091118.907596
1.2.840.113619.2.131.3171610912.1353091118.920723
1.2.840.113619.2.131.3171610912.1353091118.932988
1.2.840.113619.2.131.3171610912.1353091118.945443
into this
1.2.840.113619.2.131.3171610912.1353091118.893703.IMA
1.2.840.113619.2.131.3171610912.1353091118.907596.IMA
1.2.840.113619.2.131.3171610912.1353091118.920723.IMA
1.2.840.113619.2.131.3171610912.1353091118.932988.IMA
1.2.840.113619.2.131.3171610912.1353091118.945443.IMA
I can edit the text string before the extension, and change a series of the same extension, but I'm not sure how to deal with files of different extensions.
I'm using Windows 7.
Run the following on the command line:
ren *.* *.*.IMA