batch-processing

Batch renaming in PowerShell

心已入冬 提交于 2019-12-06 03:50:49
I'm trying to update a bunch of .jpg images so that they refresh on my website. They're currently stored on my PC like this: media +- random-project | +- 1.jpg | +- 2.jpg | +- 3.jpg | `- thumb.png +- another-random-project | +- 1.jpg | `- thumb.png I'm trying to batch rename all 1.jpg, 2.jpg etc. to 1a.jpg, 2a.jpg . I'm thinking using Windows PowerShell and something like Get-ChildItem -Recurse -Filter "[0-9]+.jpg" | foreach { $_.FullName} Dir *.jpg | Rename-Item -NewName { $_.Name -replace "[0-9]+.jpg","[0-9]a.jpg" } but have never used the program before. What do you think? mklement0 It's

Skip header, body and footer lines from file on Spring Batch

青春壹個敷衍的年華 提交于 2019-12-06 03:07:41
I have this specifically file: H;COD;CREATION_DATE;TOT_POR;TYPE H;001;2013-10-30;20;R D;DETAIL_VALUE;PROP_VALUE D;003;3030 D;002;3031 D;005;3032 T;NUM_FOL;TOT T;1;503.45 As you can see, it has header/body/footer lines. I'm looking for a ItemReader that skip these lines. I've done this ItemReader below who identify those lines, using PatternMatchingCompositeLineMapper . <bean id="fileReader" class="org.springframework.batch.item.file.FlatFileItemReader"> <property name="resource" ref="myFileReference" /> <property name="lineMapper"> <bean class="org.springframework.batch.item.file.mapping

How to configure fault tolerance programmatically for a spring tasklet (not a chunk)

一曲冷凌霜 提交于 2019-12-06 02:21:54
问题 Programmatically configuring fault tolerance for a chunk works kind of as follows: stepBuilders.get("step") .<Partner,Partner>chunk(1) .reader(reader()) .processor(processor()) .writer(writer()) .listener(logProcessListener()) .faultTolerant() .skipLimit(10) .skip(UnknownGenderException.class) .listener(logSkipListener()) .build(); The trick is, that with adding "chunk", the chain switches to a SimpleStepBuilder which offers the "faultTolerant" method. My question is how to do that if you

Batch insert using groovy Sql?

强颜欢笑 提交于 2019-12-05 23:39:55
问题 How can you do a batch insert using groovy Sql while simulating prepared statements? All the examples I've found are similar to the following and don't use prepared statements. withBatch { stmt -> stmt.addBatch("insert into table (field1,field2) values('value1','value2')") stmt.addBatch("insert into table (field1,field2) values('value3','value4')") } According to this link http://jira.codehaus.org/browse/GROOVY-3504 there is no way to use prepared statements directly from within batch. What

Get product name from WMIC for a variable in batch

旧巷老猫 提交于 2019-12-05 22:24:22
I've been struggling to get a specific output using WMIC in batch in order to build an automatic uninstall script. The issue I'm running across is that the uninstaller for the application I'm trying to remove is created under an auto-generated SSID on each system (e.g.: C:\ProgramData{07BFF8FA-C12F-46C7-8239-8EE83E21B5DA}\program-name\Uninstall.exe). Because of this, I can't build a static uninstall location based on the registry as the uninstaller string also is under the same SSID in the registry. I've tried a couple of different ways of pulling the uninstall info and the only one I've

Spring Batch how to process list of data before write in a Step

泪湿孤枕 提交于 2019-12-05 22:04:46
I am trying to read client data from database and write processed data to a flat file. But I need to process whole result of the ItemReader before write data. For example, I am reading Client from database rows : public class Client { private String id; private String subscriptionCode; private Boolean activated; } But I want to count and write how many user are activated grouped by subscriptionCode : public class Subscription { private String subscriptionCode; private Integer activatedUserCount; } I don't know how to perform that using ItemReader / ItemProcessor / ItemWriter , can you help me

Can you define an entry point in your Plone product to run a script as if it was called by bin/instance run

左心房为你撑大大i 提交于 2019-12-05 16:23:08
I have a batch job that I need to run occasionally against my Plone instance. It needs access to the code in my Plone product and other Plone code and to query the catalog. I've included the script in my Plone product and currently run it via bin/instance run <path to script in eggs directory> Obviously if a new version of my product comes along I need to change the path to point to the new version of the egg. What I'd like to do is define any entry point for the script in my product's setup.py and then use the buildout recipe like zc.recipe.egg so that I can just run bin/myscript How do I do

Spark Streaming: long queued/active batches

不羁岁月 提交于 2019-12-05 15:49:37
could anyone please point out what's the cause of this active batches hanging there for many weeks and never being processed? Thanks a lot. My guess is not enough executors, and more workers/executors will solve the problem? Or Spark assign priority on different batches within its task scheduler? But the situation here is, very recent batches (end of June) got processed successfully, but batches in May still being queued. I just checked my Spark setting, scheduler policy is FIFO spark.scheduler.mode FIFO It turns out that the master node is the bottleneck. Master node is short of memory, and

Sox batch process under Debian

北城余情 提交于 2019-12-05 14:53:07
I want to resample a bunch of wav files that I got on a folder. My script is this: for f in *.wav; do sox “$f” -r 48000 “${f%%%.wav}.wav”; done The console give me this error: "sox FAIL formats: can't open input file `“90.wav”': No such file or directory" and so on with the 300 files that are placed on that folder. How can I batch processing right this files? Why is it giving me this error? Thanks a lot! Solution: for i in *wav; do echo $i; sox $i -r 48000 ${i%%.wav}r.wav; done Summary: It is the quote symbols The problem is with the double-quotes: for f in *.wav; do sox “$f” -r 48000 “${f%%%

Rename Files using wildcard paths

放肆的年华 提交于 2019-12-05 11:55:46
Recently I started working and my first task is to write a batch file that automatically changes filenames to filename_date with the original file-ending. For that you should be able to write paths into a textfile (e.g. paths.txt) and when you start the program, it should take any line (=path->file) from there and rename it. I got it to work on my PC quiet well but as I gave it to testing they asked to make the use of wildcards Z:\Path\*.* possible. My current code looks as follows: @echo off setlocal EnableDelayedExpansion cd %~dp0 For /F "tokens=*" %%m in (paths.txt) do ( set path=%%~dpm set