Skip to content

Commit

Permalink
Explain patterns.
Browse files Browse the repository at this point in the history
  • Loading branch information
kathy-snider authored Mar 10, 2021
1 parent 98732f7 commit 6cb1fdf
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,26 @@
The JSON file contains 2 elements:
* The directory tree of the folder being cleaned in the "file_system_data" of
* the json. This is the "rules" portion that tells the script what to do (keep
* or delete) for each file and folder. The tree must match the directory tree
* of the folder being cleaned.
the json. This is the "rules" portion that tells the script what to do (keep
or delete) for each file and folder. The tree must match the directory tree
of the folder being cleaned.
* The "pattern_list" whose value is a list of pattern strings.

## Patterns
> If the data to be cleaned contains numbered files or folders, you can choose
> to apply a rule (keep or delete) for one numbered file to all matching,
> numbered files and folders.
to apply a rule (keep or delete) for one numbered file to all matching,
numbered files and folders.

To do this, either add a pattern to the "pattern_list" or use the pattern flag
in the cleaning script, below.

#### Example 1
> You have BIDS data and a lot of files and folder contain strings like
> "task-rest_run-01". You don't know how many runs there are going to be, but
> you want the rules for all task-rest runs to be the same.
* Put rules in your tree for files and folders whose names contain
* "task-rest_run-01".
"task-rest_run-01". You don't know how many runs there are going to be, but
you want the rules for all task-rest runs to be the same.
* Put rules in your tree for files and folders whose names contain "task-rest_run-01".
* Add the pattern "task-rest_run-\*" to the list value of the "pattern_list"
* element. (The \* is shorthand for all numbers.)
element. (The \* is shorthand for all numbers.)

All rules containing "task-rest_run-" followed by any number will be applied to
all files and folders whose names contain "task-rest_run-" followed by any
Expand All @@ -38,9 +37,9 @@ patterns until you get used to them.

#### Example 2
> There is a set of files in your data called temp01, temp02, .... Again, you
> don't know how many there will be, but you want them all gone.
don't know how many there will be, but you want them all gone.
* Make a rule for a file called temp0 (or temp6 or temp382 - doesn't matter,
* just temp followed by a number). Set the value of its "state" to "delete".
just temp followed by a number). Set the value of its "state" to "delete".
* Add a pattern to the list for "temp*".

Don't worry, all of your files with "template" in their names will not
Expand All @@ -49,7 +48,7 @@ disappear. Only files with the string "temp" followed directly by a number.

## CustomClean Cleaning Script (`cleaning_script.py`)
> Delete things in a given directory based on the rules and patterns given in
> the JSON.
the JSON.

Required arguments:
* -j --json [path to JSON]
Expand All @@ -66,8 +65,8 @@ of the target directory.

## CustomClean GUI
> **NOTE** As of 2.0.0, the cleaning script does not work with JSON files
> created by the CustomClean GUI. To use the GUI and a cleaning script, use an
> older version of CustomClean (pre 2.0.0). We hope to remedy this soon!
created by the CustomClean GUI. To use the GUI and a cleaning script, use an
older version of CustomClean (pre 2.0.0). We hope to remedy this soon!

## Installation
1. Requires Python.
Expand Down

0 comments on commit 6cb1fdf

Please sign in to comment.