0
votes

I'm puzzeling with a shell script.

What am I trying to achieve?

  • In my 'upload2website'-folder on my Mac I have numerous files that have the following AA_bestandsnaam-xx.jpg or AA_bestandsnaam - xx.jpg (Watch the spaces). xx is a filenumber, could be any number.
  • Below the 'upload2website'-folder there a several subfolders.
  • In the subfolder below upload2website there are the origins of AA_bestandnaam-xx.jpg or AA_bestandnaam - xx.jpg
  • If the file is in upload2website is found in one of the subfolders, then copy it to the folders uploads
  • It is possible that the AA is placed at the end of the file, f.i. bestandnaam-xx_AA.jpg

Example of the structure

upload2website-folder

  • AA_bestandsnaamA-68.jpg
  • AA_bestandsnaamB - 01.jpg
  • AA_bestandsnaamC-106.jpg
  • AA_bestandsnaamD-30.jpg

subfolders

  • upload2website/folder1/bestandsnaamA-13.jpg
  • upload2website/folder1/bestandsnaamA-28.jpg
  • upload2website/folder1/bestandsnaamA-68.jpg
  • upload2website/folder1/bestandsnaamA-90.jpg
  • upload2website/folder2/bestandsnaamB - 08.jpg
  • upload2website/folder2/bestandsnaamB - 09.jpg
  • upload2website/folder2/bestandsnaamB - 10.jpg
  • upload2website/folder2/bestandsnaamB - 13.jpg
  • upload2website/folder2/bestandsnaamB - 01.jpg
  • upload2website/folder3/bestandsnaamC-08.jpg
  • upload2website/folder3/bestandsnaamC-90.jpg
  • upload2website/folder3/bestandsnaamC-105.jpg
  • upload2website/folder3/bestandsnaamC-106.jpg
  • etc.

The following script I'm working on, but that doesn't work, f.i. if there are spaces in the name, than name is truncated as of the first space. I already added -iname and quotes around the variables.

#!/bin/sh
SRCDIR=upload2website
DSTDIR=uploads
PREFIX=FB_
UPLOAD=`ls "$SRCDIR"/*.jpg`
#SEARCH=`$UPLOAD | sed "/$PREFIX/s///"`
for src in $UPLOAD
do
   # echo source: "$src"
   test="`basename "$src"`"
   FBname=`basename "$src"  | sed "/$PREFIX/s///"`
   # name=`basename "$src"`
   # echo name: "$name"

   #dst=`find "$DSTDIR" -name "$FBname"`
   dst=`find "$SRCDIR" -iname "$FBname"`
   # if [ "$dst" != "" ]; then

   if [ "$dst" != "" ]; then
    echo FBname: "$FBname"
     echo cp "$dst" "$DSTDIR"
   fi
done

Can somebody please help me to get the script right?

Update: Clarify folders

the folderstructure:

  • /Users/gjdegraaf/Documents/upload2website <<<--- contains subfolders and origin of the image files
  • /Users/gjdegraaf/Documents/uploads. <<<--- should contain the copied origin of the file that matches the file without AA_
4
What should the execution of your script output? Which files should be copied where for the input provided?KamilCuk
The origin of the file found in one of the subfolders below upload2website should be found and copied to uploads.user2037412
So cp upload2website/AA_bestandsnaamA-68.jpg uploads cp upload2website/AA_bestandsnaamB - 01.jpg uploads cp upload2website/AA_bestandsnaamC-106.jpg uploads should be the output from your script? Please try not to describe, rather please show what should happen. or cp upload2website/folder1/bestandsnaamA-68.jpg uploads cp upload2website/folder2/bestandsnaamB - 01.jpg uploads cp upload2website/folder3/bestandsnaamC-106.jpg uploads? And why you describe the prefix to be AA_ yet your script has FB_?KamilCuk
@KamilCuk the second part of your example should happen. Sorry if it was confusing.user2037412

4 Answers

1
votes
  • Use $(...) instead of `. Backticks are discouraged`.
  • Don't for i in $(ls). Forget about ls. Never use ls in scripts. Forget it. Use find.
  • Don't use uppercase variables for local variables. By convention uppercase variables are exported. And you can run into clashes, for example RANDOM.

I don't fully understand where is uploads dir and how is it related to upload2website dir and how the structure really is. But maybe the folowing code snippets will help you with some ideas.

Your script could look like this:

#!/bin/sh
srcdir=upload2website
dstdir=uploads
prefix=FB_
# output a newline separated list of filenames in srcdir
find "$srcdir" -mindepth 2 -maxdepth 2 -type f -name '*.jpg' |
# read the newline separated list
while IFS= read -r src; do
   filename=$(basename "$src")
   # NOTE: here prefix is  FB_ not AA_ ....
   FBname=$(printf "%s\n" "$filename" | sed "s/$prefix//")
   # check if the file FBname exists in src folder
   if dst=$(
                    find "$srcdir" -maxdepth 1 -type f |
          grep "$FBname"
                    ); then
      echo cp "$src" "$dstdir"
   fi
done

Bu I would most probably do something like this, which needs bash:

#!/bin/bash
src=upload2website
dst=uploads
prefix=FB_

# find all files in src dir
find "$src" -maxdepth 1 -type f -printf "%f\n" |
# remove all the `AA_`
sed 's@^AA_@@; s/_AA\.jpg$//;' |
sort |
# filter from the list the files from dst
# output only paths
join -t$'\t' -11 -21 -o2.2 - <(
    # a newline separated list with two tab separated columns
    find "$src" -maxdepth 2 -mindepth 2 -type f -printf '%f\t%p\n' |
    # sort on filename
    sort -k1
) |
# copy the files
xargs -I{} echo cp {} "$dst"

I tested on repl both scripts and they outputted:

cp upload2website/folder1/bestandsnaamA-68.jpg uploads
cp upload2website/folder2/bestandsnaamB - 01.jpg uploads
cp upload2website/folder3/bestandsnaamC-106.jpg uploads

But I don't fully understand which folder is uploads and which is not.

Both scripts still assume there are no newline in the filenames. It is possible to rewrite the second code snippet to use zero terminated streams, with GNU sed -z option, find -print0, join -z, xargs -0 and sort -z. You can get around tabulation used for separator with good cut -d$'\t' -f2-, the following code uses gnu tools and bash and should be able to handle any filenames except those with the byte 0x01 in the filenames:

sep=$'\x01'
# find all files in src dir
find "$src" -maxdepth 1 -type f -printf "%f\0" |
# remove all the `AA_`
sed -z 's@^AA_@@; s/_AA\.jpg$//;' |
sort -z |
# filter from the list the files from dst
# output only paths
join -z -t"$sep" -11 -21 - <(
    # a newline separated list with two tab separated columns
    find "$src" -maxdepth 2 -mindepth 2 -type f -printf "%f$sep%p\0" |
    # sort on filename
    sort -z -t$sep -s -k1
) |
cut -z -d"$sep" -f2- |
# copy the files
xargs -0 -I{} echo cp {} "$dst"
0
votes

You can do this way:

dst=`find "$SRCDIR" -iname "$FBname" -type f -print0 | xargs -0 ls -1 `

When reading filenames with spaces, you need to use print0, and you need to built it using xargs with -0 option.

0
votes

I think you can do this in one line.

Your goal could be separated into the following steps

  1. get the filename at the root of upload2website

    find upload2website -maxdepth 1 -type f

  2. for each file, trim the path part, trim the leading "AA_"

    x={}; x=${x##*/}; if he AA_ is always at the beginning, you can use x=${x:3} to substring it. but since you mentioned that it could also be at the end, you should add x=${x#AA_};x=${x%_AA}

  3. get the filelist in subfolders

    find upload2website -type f -mindepth 2

  4. use the grep to select the matched files, and copy them

so taken these together

find upload2website -maxdepth 1 -type f|\ parallel \ 'x={};x=${x##*/};x=${x#AA_};x=${x%_AA}; \ find upload2website -type f -mindepth 2 |\ grep "$x" -' |\ parallel 'cp {} upload'

I have just tested on my macbook and it works.

If you don't have parallel, you can install it by

brew install parallel

actually, if you are using parallel, you can just get the pure file name by $x={/} instead of x={};x=${x##*/}; above.

the result is like below

.
├── upload
│   ├── bestandsnaamA-68.jpg
│   ├── bestandsnaamB\ -\ 01.jpg
│   └── bestandsnaamC-106.jpg
└── upload2website
    ├── AA_bestandsnaamA-68.jpg
    ├── AA_bestandsnaamB\ -\ 01.jpg
    ├── AA_bestandsnaamC-106.jpg
    ├── AA_bestandsnaamD-30.jpg
    ├── folder1
    │   ├── bestandsnaamA-13.jpg
    │   ├── bestandsnaamA-28.jpg
    │   ├── bestandsnaamA-68.jpg
    │   └── bestandsnaamA-90.jpg
    ├── folder2
    │   ├── bestandsnaamB\ -\ 01.jpg
    │   ├── bestandsnaamB\ -\ 08.jpg
    │   ├── bestandsnaamB\ -\ 09.jpg
    │   ├── bestandsnaamB\ -\ 10.jpg
    │   └── bestandsnaamB\ -\ 13.jpg
    ├── folder3
    │   ├── bestandsnaamC-08.jpg
    │   ├── bestandsnaamC-105.jpg
    │   ├── bestandsnaamC-106.jpg
    │   └── bestandsnaamC-90.jpg
0
votes

UPDATE / EDIT

Used the following script:

#!/usr/local/bin/bash
src=upload2website
dst=uploads
prefix=FB_

# find all files in src dir
gfind "$src" -maxdepth 1 -type f -printf "%f\n" |
# remove all the `FB_`
sed 's@^FB_@@; s/_FB\.jpg$//;' |
sort |
# filter from the list the files from dst
# output only paths
join -t$'\t' -11 -21 -o2.2 - <(
    # a newline separated list with two tab separated columns
    gfind "$src" -maxdepth **5** -mindepth 2 -type f -printf '%f\t%p\n' |
    # sort on filename
    sort -k1
) |
# copy the files
xargs -I{} echo cp {} "$dst"
~                                                                                                                                                                         
~                                                                                                                                                                         
~                                                                                                                                                                         
"stack.sh" 20L, 518C written

The output (just put all output for the sake of clarity). Sorry for the worse lay-out. As you can see, it copies .DS_Store files too and these should not be selected, however these are easy to remove in de uploads-folder.

➜ Documents ./stack.sh cp upload2website/40MijlvanBru/.DS_Store uploads cp upload2website/8Uur van de Oosterschelde/.DS_Store uploads cp upload2website/Almere Regatta 2015/.DS_Store uploads cp upload2website/Antwerpen-2019/.DS_Store uploads cp upload2website/Antwerpen/.DS_Store uploads cp upload2website/Beaucette-Lezardrieux/.DS_Store uploads cp upload2website/Bembridge - Cowes/.DS_Store uploads cp upload2website/Bocht van Guinea/.DS_Store uploads cp upload2website/Boiler Isotemp/.DS_Store uploads cp upload2website/Boot/.DS_Store uploads cp upload2website/Boulogne/.DS_Store uploads cp upload2website/Burnham-on-Crouch - Vlissingen/.DS_Store uploads cp upload2website/Carteret-Dielette/.DS_Store uploads cp upload2website/Elektra/.DS_Store uploads cp upload2website/GrandcampMaisy-Ouistreham/.DS_Store uploads cp upload2website/Herkingen, Zuid-Holland - Jachthaven, 3 februari 2018/.DS_Store uploads cp upload2website/JWvdM/.DS_Store uploads cp upload2website/Kajuitramen/.DS_Store uploads cp upload2website/Kiel/.DS_Store uploads cp upload2website/Koelkast/.DS_Store uploads cp upload2website/Kuip/.DS_Store uploads cp upload2website/Lazy bag/.DS_Store uploads cp upload2website/Littlehampton-BirdhamPool/.DS_Store uploads cp upload2website/Lummelbeslag/.DS_Store uploads cp upload2website/Lymington/.DS_Store uploads cp upload2website/Middelburg-Veere/.DS_Store uploads cp upload2website/Nieuwpoort-Blankenberge/.DS_Store uploads cp upload2website/Onderwaterschip/.DS_Store uploads cp upload2website/Onweer_NVvT/.DS_Store uploads cp upload2website/Overtocht DCS/.DS_Store uploads cp upload2website/Pasen_2019/.DS_Store uploads cp upload2website/PropOne-antifouling/.DS_Store uploads cp upload2website/Roer/.DS_Store uploads cp upload2website/Roer/Roer/.DS_Store uploads cp upload2website/Rondje Engeland/.DS_Store uploads cp upload2website/Rondje Engeland/001-Vertrek-Lowestoft/.DS_Store uploads cp upload2website/Rondje Engeland/003-Wells-next-the-Sea/.DS_Store uploads cp upload2website/Rondje Engeland/006-Whitby-Newcastle/.DS_Store uploads cp upload2website/Rondje Engeland/007-Newcastle/.DS_Store uploads cp upload2website/Rondje Engeland/008-Newcastle-Amble/.DS_Store uploads cp upload2website/Rondje Engeland/012-Edinburgh-Arbroath/.DS_Store uploads cp upload2website/Rondje Engeland/016-Peterhead/.DS_Store uploads cp upload2website/Rondje Engeland/018-Lossiemouth/.DS_Store uploads cp upload2website/Rondje Engeland/024-Caledonian Canal-Fort Augustus/.DS_Store uploads cp upload2website/Rondje Engeland/026-Laggan Lock-Banavie/.DS_Store uploads cp upload2website/Rondje Engeland/028-Banavie-Corpach Basin/.DS_Store uploads cp upload2website/Rondje Engeland/029-Corpach Basin-Dunstaffnage/.DS_Store uploads cp upload2website/Rondje Engeland/031-Tobermory/.DS_Store uploads cp upload2website/Rondje Engeland/036-Lamlash/.DS_Store uploads cp upload2website/Rondje Engeland/038-Campbeltown-Belfast/.DS_Store uploads cp upload2website/Rondje Engeland/039-Belfast/.DS_Store uploads cp upload2website/Rondje Engeland/042-Dublin/.DS_Store uploads cp upload2website/Rondje Engeland/050-Padstow-Newlyn/.DS_Store uploads cp upload2website/Rondje Engeland/052-Fowey-Dartmouth/.DS_Store uploads cp upload2website/Rondje Engeland/053-Dartmouth-Weymouth/.DS_Store uploads cp upload2website/Rondje Engeland/057-Eastbourne-Dover/.DS_Store uploads cp upload2website/Rondje Engeland/061-St_Annaland-Herkingen/.DS_Store uploads cp upload2website/Rondje Engeland/Krabbeltje/.DS_Store uploads cp upload2website/Rondje Kanaal 2012/.DS_Store uploads cp upload2website/Schroef/.DS_Store uploads cp upload2website/StVaast-GrandcampMaisy/.DS_Store uploads cp upload2website/Te water/.DS_Store uploads cp upload2website/Toilet/.DS_Store uploads cp upload2website/Uisge/.DS_Store uploads cp upload2website/Uisge/40Myl/.DS_Store uploads cp upload2website/Uisge/UK/.DS_Store uploads cp upload2website/VDO Urenteller/.DS_Store uploads cp upload2website/Vakantie 2014/.DS_Store uploads cp upload2website/Vakantie 2015/.DS_Store uploads cp upload2website/Veere/.DS_Store uploads cp upload2website/Verkoop/.DS_Store uploads cp upload2website/Verzekeringscasus/.DS_Store uploads cp upload2website/Zomer 2016/.DS_Store uploads cp upload2website/Zomervakantie/.DS_Store uploads cp upload2website/27 apr. 2007/1213030320_dscf1547_small.jpg uploads cp upload2website/Uisge/2.jpg uploads cp upload2website/Uisge/3.jpg uploads cp upload2website/40MijlvanBru/40MijlvanBru-27.jpg uploads cp upload2website/40MijlvanBru/40MijlvanBru-31.jpg uploads cp upload2website/8Uur van de Oosterschelde/8UurvandeOosterschelde-035.jpg uploads cp upload2website/Antwerpen-2019/Antwerpen-2019-14.jpg uploads cp upload2website/Antwerpen-2019/Antwerpen-2019-38.jpg uploads cp upload2website/Boiler Isotemp/Boiler-01.jpg uploads cp upload2website/Boiler Isotemp/Boiler-07.jpg uploads cp upload2website/Dek schilderen/Dek schilderen - 20.jpg uploads cp upload2website/Fenderhoes/Fenderhoes-08.jpg uploads cp upload2website/Herkingen, Zuid-Holland - Jachthaven, 3 februari 2018/Heat-exchanger-06.jpg uploads cp upload2website/Honfleur/Honfleur - 21.jpg uploads cp upload2website/09april16/IMG_3799.jpg uploads cp upload2website/Kajuitramen/Kajuitramen - 92.jpg uploads cp upload2website/Kajuitramen/Kajuitramen - 95.jpg uploads cp upload2website/Kajuitramen/Kajuitramen±-±21.jpg uploads cp upload2website/Aanhechting kiel romp/Kitrand_romp_kiel-01.jpg uploads cp upload2website/Koelkast/Koelkast - 15.jpg uploads cp upload2website/Koelkast/Koelkast - 30.jpg uploads cp upload2website/Koelkast/Koelkast - 36.jpg uploads cp upload2website/Lummelbeslag/Lummelbeslag - 09.jpg uploads cp upload2website/Onderwaterschip/Onderwaterschip-48.jpg uploads cp upload2website/Pasen_2019/Pasen_2019-15.jpg uploads cp upload2website/PropOne-antifouling/PropOne-antifouling-06.jpg uploads cp upload2website/Radiateur/Radiateur - 01.jpg uploads cp upload2website/Radiateur/Radiateur - 02.jpg uploads cp upload2website/Radiateur/Radiateur - 03.jpg uploads cp upload2website/Radiateur/Radiateur - 04.jpg uploads cp upload2website/Radiateur/Radiateur - 05.jpg uploads cp upload2website/Tewaterlating/Tewaterlating-01.jpg uploads cp upload2website/Uisge/Uitslag-Marathon2012.jpg uploads cp upload2website/Vakantie 2014/Vakantie 2014 - 129.jpg uploads cp upload2website/Waterpomp/Waterpomp - 4.jpg uploads cp upload2website/Waterpomp/Waterpomp - 5.jpg uploads cp upload2website/Zomer 2016/Duinkerken - Boulogne sur Mer/Zomer 2016 - 096.jpg uploads cp upload2website/Zomervakantie/Zomervakantie-09.jpg uploads cp upload2website/Zomervakantie/Zomervakantie-119.jpg uploads cp upload2website/Zomervakantie/Zomervakantie-135.jpg uploads cp upload2website/Zomervakantie/Zomervakantie-142.jpg uploads cp upload2website/Zomervakantie/Zomervakantie-144.jpg uploads cp upload2website/Zomervakantie/Zomervakantie-15.jpg uploads cp upload2website/Zomervakantie/Zomervakantie-158.jpg uploads cp upload2website/Zomervakantie/Zomervakantie-162-test.jpg uploads cp upload2website/Zomervakantie/Zomervakantie-22.jpg uploads cp upload2website/Zomervakantie/Zomervakantie-24.jpg uploads cp upload2website/Zomervakantie/Zomervakantie-30.jpg uploads cp upload2website/Zomervakantie/Zomervakantie-47.jpg uploads cp upload2website/Zomervakantie/Zomervakantie-64.jpg uploads cp upload2website/Zomervakantie/Zomervakantie-82.jpg uploads cp upload2website/Zomervakantie/Zomervakantie-87.jpg uploads cp upload2website/Zomervakantie/Zomervakantie-93.jpg uploads

If I count the number of files copied, I'm missig around 90 files. I don't know how to add a text file to this post otherwise I could show the files containing (AA_ of AA) actually FB or _FB but that's of no importance to the solution. It might be even so to take all *.jpg files from the upload2website folder and see if there is a occurence in one of the subfolders below upload2website.

** UPDATE 03jan20 **

Managed to modify the script to exclude files starting with a dot:

#!/usr/local/bin/bash
src=upload2website
dst=uploads
prefix=FB_

# find all files in src dir
# gfind "$src" -maxdepth 1  -type f -printf "%f\n" |
gfind "upload2website" -maxdepth 1 -type f \( ! -iname  ".*" -iname "*.jpg" \) -printf "%f\n" | 
# remove all the `FB_`
# sed 's@^FB_@@; s/FB//; s/_FB\.jpg$//;' |
sed 's@^FB_@@; s/FB//; s/_FB\.jpg$//;' |
sort |
# filter from the list the files from dst
# output only paths
join -t$'\t' -11 -21 -o2.2 - <(
    # a newline separated list with two tab separated columns
    gfind "$src"  -mindepth 2 -type f -printf '%f\t%p\n' |
    # sort on filename
    sort -k1
) |
# copy the files
xargs -I{} echo cp {} "$dst"

I think the join is missing some file, because

➜  Documents gfind "upload2website" -maxdepth 1 -type f \( ! -iname  ".*" -iname "*.jpg" \) -printf "%f\n" | sed 's@^FB_@@; s/FB//; s/_FB\.jpg$//;' | sort > tmp.txt

gives alle requested files from upload2website, however I'm missing a search to the files in f.i. the following folders: (again, sorry for the poor lay-out).

➜ Documents l upload2website/Rondje\ Engeland/ total 5236192 drwxr-xr-x 89 gjdegraaf staff 2,8K 2 jan 22:11 . drwxr-x-wx@ 431 gjdegraaf staff 13K 2 jan 22:27 .. drwxr-xr-x 25 gjdegraaf staff 800B 2 jan 22:11 001-Vertrek-Lowestoft drwxr-xr-x 13 gjdegraaf staff 416B 6 jun 2019 002-Lowestoft-Wells-next-the-Sea drwxr-xr-x 74 gjdegraaf staff 2,3K 2 jan 22:11 003-Wells-next-the-Sea drwxr-xr-x 12 gjdegraaf staff 384B 10 jun 2019 004-Wells-next-the-Sea-Whitby drwxr-xr-x 21 gjdegraaf staff 672B 15 jun 2019 005-Whitby drwxr-xr-x 9 gjdegraaf staff 288B 2 jan 22:11 006-Whitby-Newcastle drwxr-xr-x 56 gjdegraaf staff 1,8K 2 jan 22:11 007-Newcastle drwxr-xr-x 20 gjdegraaf staff 640B 2 jan 22:11 008-Newcastle-Amble drwxr-xr-x 26 gjdegraaf staff 832B 24 jun 2019 009-Amble drwxr-xr-x 25 gjdegraaf staff 800B 24 jun 2019 010-Amble-Edinburgh drwxr-xr-x 19 gjdegraaf staff 608B 26 jun 2019 011-Edinburgh drwxr-xr-x 12 gjdegraaf staff 384B 2 jan 22:11 012-Edinburgh-Arbroath drwxr-xr-x 18 gjdegraaf staff 576B 28 jun 2019 013-Arbroath drwxr-xr-x 10 gjdegraaf staff 320B 29 jun 2019 014-Arbroath-Peterhead drwxr-xr-x 20 gjdegraaf staff 640B 30 jun 2019 015-Aberdeen-Peterhead drwxr-xr-x 28 gjdegraaf staff 896B 2 jan 22:11 016-Peterhead drwxr-xr-x 10 gjdegraaf staff 320B 6 jul 07:41 017-Peterhead-Lossiemouth drwxr-xr-x 44 gjdegraaf staff 1,4K 2 jan 22:11 018-Lossiemouth drwxr-xr-x 7 gjdegraaf staff 224B 12 jul 19:08 019-Lossiemouth-Cromarty drwxr-xr-x 20 gjdegraaf staff 640B 17 jul 08:24 020-Cromarty drwxr-xr-x 7 gjdegraaf staff 224B 17 jul 08:27 021-Cromarty-Rosemarkie Bay drwxr-xr-x 11 gjdegraaf staff 352B 17 jul 08:28 022-Rosemarkie Bay-Inverness drwxr-xr-x 20 gjdegraaf staff 640B 19 jul 06:34 023-Inverness-Caledonian Canal drwxr-xr-x 34 gjdegraaf staff 1,1K 2 jan 22:11 024-Caledonian Canal-Fort Augustus drwxr-xr-x 27 gjdegraaf staff 864B 22 jul 08:04 025-Fort Augustus-Laggan Lock drwxr-xr-x 12 gjdegraaf staff 384B 2 jan 22:11 026-Laggan Lock-Banavie drwxr-xr-x 61 gjdegraaf staff 1,9K 25 jul 08:01 027-Ben Nevis drwxr-xr-x 14 gjdegraaf staff 448B 2 jan 22:11 028-Banavie-Corpach Basin drwxr-xr-x 20 gjdegraaf staff 640B 2 jan 22:11 029-Corpach Basin-Dunstaffnage

Could someone help me with the join in the script? I do understand how a join works, however not in scripting. Thanks!